Skip to content

Commit 3375634

Browse files
Fail empty scope tests with empty fixtures (#2908)
Fail scope tests with no scopes Fixes #2844
1 parent 3336815 commit 3375634

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/cursorless-vscode-e2e/src/suite/scopes.vscode.test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ async function runTest(file: string, languageId: string, facetId: string) {
123123

124124
const editor = ide.activeTextEditor!;
125125

126-
const outputFixture = ((): string => {
126+
const [outputFixture, numScopes] = ((): [string, number] => {
127127
const config = {
128128
visibleOnly: false,
129129
scopeType,
@@ -137,17 +137,21 @@ async function runTest(file: string, languageId: string, facetId: string) {
137137
includeNestedTargets: false,
138138
},
139139
);
140-
return serializeIterationScopeFixture(code, iterationScopes);
140+
return [
141+
serializeIterationScopeFixture(code, iterationScopes),
142+
iterationScopes.length,
143+
];
141144
}
142145

143146
const scopes = scopeProvider.provideScopeRanges(editor, config);
144147

145-
return serializeScopeFixture(facetId, code, scopes);
148+
return [serializeScopeFixture(facetId, code, scopes), scopes.length];
146149
})();
147150

148151
if (shouldUpdateFixtures()) {
149152
await fsp.writeFile(file, outputFixture);
150153
} else {
154+
assert.isAbove(numScopes, 0, "No scopes found");
151155
assert.equal(outputFixture, fixture);
152156
}
153157
}

0 commit comments

Comments
 (0)