Skip to content

Commit 7534e31

Browse files
authored
Fail tests if we can't run them (#7970)
1 parent ae358fc commit 7534e31

1 file changed

Lines changed: 11 additions & 15 deletions

File tree

src/test/index.ts

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,17 @@ async function runAllExtensionTests(testsRoot: string, clb: (error: Error | null
3838
importAll(require.context('./', true, /\.test$/));
3939
} catch (e) {
4040
// Fallback if 'require.context' is not available (e.g., in non-webpack environments)
41-
try {
42-
const files = glob.sync('**/*.test.js', {
43-
cwd: testsRoot,
44-
absolute: true,
45-
// Browser/webview tests are loaded via the separate browser runner
46-
ignore: ['browser/**']
47-
});
48-
if (!files.length) {
49-
console.log('Fallback test discovery found no test files. Original error:', e);
50-
}
51-
for (const f of files) {
52-
mocha.addFile(f);
53-
}
54-
} catch (fallbackErr) {
55-
console.log('Both require.context and glob fallback failed to load tests', fallbackErr);
41+
const files = glob.sync('**/*.test.js', {
42+
cwd: testsRoot,
43+
absolute: true,
44+
// Browser/webview tests are loaded via the separate browser runner
45+
ignore: ['browser/**']
46+
});
47+
if (!files.length) {
48+
console.log('Fallback test discovery found no test files. Original error:', e);
49+
}
50+
for (const f of files) {
51+
mocha.addFile(f);
5652
}
5753
}
5854

0 commit comments

Comments
 (0)