Skip to content

Commit 4dc2d17

Browse files
committed
Fixed test failing when run normally (not debug).
1 parent b5fe16d commit 4dc2d17

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

client/src/test/foldingRanges.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,18 @@ async function testFoldingRanges(docUri: vscode.Uri, expectedFoldingRanges: vsco
2727
const action = () => vscode.commands.executeCommand<vscode.FoldingRange[]>(
2828
'vscode.executeFoldingRangeProvider',
2929
docUri
30-
)
30+
);
3131

3232
// Use this method first to ensure the extension is activated.
3333
const actualFoldingRanges = await runOnActivate(
3434
action,
35-
(result) => Array.isArray(result) && result.length > 0
35+
// Test returns 7 folding ranges when run in normal mode
36+
// but six in debug. Appears to be an issue with timing,
37+
// probably due to the editor guessing before LSP kicks in.
38+
(result) => Array.isArray(result) && result.length === expectedFoldingRanges.length
3639
);
3740

38-
assert.equal(actualFoldingRanges.length ?? 0, expectedFoldingRanges.length, "Count");
39-
41+
// No need to assert length as this test will throw if it's not the same.
4042
expectedFoldingRanges.forEach((expectedFoldingRange, i) => {
4143
const actualFoldingRange = actualFoldingRanges[i];
4244
assert.deepEqual(actualFoldingRange, expectedFoldingRange, `FoldingRange ${i}`);

0 commit comments

Comments
 (0)