1111// SPDX-License-Identifier: Apache-2.0
1212//
1313//===----------------------------------------------------------------------===//
14+ // @ts -check
1415
1516const { defineConfig } = require ( "@vscode/test-cli" ) ;
1617const path = require ( "path" ) ;
1718const { version, publisher, name } = require ( "./package.json" ) ;
1819
1920const isCIBuild = process . env [ "CI" ] === "1" ;
20- const isFastTestRun = process . env [ "FAST_TEST_RUN" ] === "1" ;
2121
2222const dataDir = process . env [ "VSCODE_DATA_DIR" ] ;
2323
24- // "env" in launch.json doesn't seem to work with vscode-test
24+ // Check if we're debugging by looking at the process executable. Unfortunately, the VS Code debugger
25+ // doesn't seem to allow setting environment variables on a launched extension host.
2526const isDebugRun = ! ( process . env [ "_" ] ?? "" ) . endsWith ( "node_modules/.bin/vscode-test" ) ;
2627
27- function log ( ... args ) {
28+ function log ( /** @type { string } */ message ) {
2829 if ( ! isDebugRun ) {
29- console . log ( ... args ) ;
30+ console . log ( message ) ;
3031 }
3132}
3233
33- // so tests don't timeout when a breakpoint is hit
34- const timeout = isDebugRun ? Number . MAX_SAFE_INTEGER : 3000 ;
34+ // Remove the default timeout when debugging to avoid test failures when a breakpoint is hit.
35+ // Keep this up to date with the timeout of a 'small' test in 'test/tags.ts'.
36+ const timeout = isDebugRun ? 0 : 2000 ;
3537
3638const launchArgs = [
3739 "--disable-updates" ,
@@ -96,6 +98,7 @@ for (const ext of installExtensions) {
9698const env = {
9799 ...process . env ,
98100 RUNNING_UNDER_VSCODE_TEST_CLI : "1" ,
101+ VSCODE_DEBUG : isDebugRun ? "1" : "0" ,
99102} ;
100103log ( "Running tests against environment:\n" + JSON . stringify ( env , undefined , 2 ) ) ;
101104
@@ -115,8 +118,6 @@ module.exports = defineConfig({
115118 color : true ,
116119 timeout,
117120 forbidOnly : isCIBuild ,
118- grep : isFastTestRun ? "@slow" : undefined ,
119- invert : isFastTestRun ,
120121 slow : 10000 ,
121122 retries : 1 ,
122123 reporter : path . join ( __dirname , ".mocha-reporter.js" ) ,
@@ -128,7 +129,6 @@ module.exports = defineConfig({
128129 } ,
129130 installExtensions : extensionDependencies ,
130131 skipExtensionDependencies : installConfigs . length > 0 ,
131- reuseMachineInstall : ! isCIBuild ,
132132 } ,
133133 {
134134 label : "codeWorkspaceTests" ,
@@ -151,8 +151,6 @@ module.exports = defineConfig({
151151 color : true ,
152152 timeout,
153153 forbidOnly : isCIBuild ,
154- grep : isFastTestRun ? "@slow" : undefined ,
155- invert : isFastTestRun ,
156154 slow : 10000 ,
157155 retries : 1 ,
158156 reporter : path . join ( __dirname , ".mocha-reporter.js" ) ,
@@ -164,7 +162,6 @@ module.exports = defineConfig({
164162 } ,
165163 installExtensions : extensionDependencies ,
166164 skipExtensionDependencies : installConfigs . length > 0 ,
167- reuseMachineInstall : ! isCIBuild ,
168165 } ,
169166 {
170167 label : "unitTests" ,
@@ -186,7 +183,6 @@ module.exports = defineConfig({
186183 } ,
187184 } ,
188185 skipExtensionDependencies : true ,
189- reuseMachineInstall : ! isCIBuild ,
190186 } ,
191187 // you can specify additional test configurations, too
192188 ] ,
0 commit comments