11
11
// SPDX-License-Identifier: Apache-2.0
12
12
//
13
13
//===----------------------------------------------------------------------===//
14
+ // @ts -check
14
15
15
16
const { defineConfig } = require ( "@vscode/test-cli" ) ;
16
17
const path = require ( "path" ) ;
17
18
const { version, publisher, name } = require ( "./package.json" ) ;
18
19
19
20
const isCIBuild = process . env [ "CI" ] === "1" ;
20
- const isFastTestRun = process . env [ "FAST_TEST_RUN" ] === "1" ;
21
21
22
22
const dataDir = process . env [ "VSCODE_DATA_DIR" ] ;
23
23
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.
25
26
const isDebugRun = ! ( process . env [ "_" ] ?? "" ) . endsWith ( "node_modules/.bin/vscode-test" ) ;
26
27
27
- function log ( ... args ) {
28
+ function log ( /** @type { string } */ message ) {
28
29
if ( ! isDebugRun ) {
29
- console . log ( ... args ) ;
30
+ console . log ( message ) ;
30
31
}
31
32
}
32
33
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 ;
35
37
36
38
const launchArgs = [
37
39
"--disable-updates" ,
@@ -96,6 +98,7 @@ for (const ext of installExtensions) {
96
98
const env = {
97
99
...process . env ,
98
100
RUNNING_UNDER_VSCODE_TEST_CLI : "1" ,
101
+ VSCODE_DEBUG : isDebugRun ? "1" : "0" ,
99
102
} ;
100
103
log ( "Running tests against environment:\n" + JSON . stringify ( env , undefined , 2 ) ) ;
101
104
@@ -115,8 +118,6 @@ module.exports = defineConfig({
115
118
color : true ,
116
119
timeout,
117
120
forbidOnly : isCIBuild ,
118
- grep : isFastTestRun ? "@slow" : undefined ,
119
- invert : isFastTestRun ,
120
121
slow : 10000 ,
121
122
retries : 1 ,
122
123
reporter : path . join ( __dirname , ".mocha-reporter.js" ) ,
@@ -128,7 +129,6 @@ module.exports = defineConfig({
128
129
} ,
129
130
installExtensions : extensionDependencies ,
130
131
skipExtensionDependencies : installConfigs . length > 0 ,
131
- reuseMachineInstall : ! isCIBuild ,
132
132
} ,
133
133
{
134
134
label : "codeWorkspaceTests" ,
@@ -151,8 +151,6 @@ module.exports = defineConfig({
151
151
color : true ,
152
152
timeout,
153
153
forbidOnly : isCIBuild ,
154
- grep : isFastTestRun ? "@slow" : undefined ,
155
- invert : isFastTestRun ,
156
154
slow : 10000 ,
157
155
retries : 1 ,
158
156
reporter : path . join ( __dirname , ".mocha-reporter.js" ) ,
@@ -164,7 +162,6 @@ module.exports = defineConfig({
164
162
} ,
165
163
installExtensions : extensionDependencies ,
166
164
skipExtensionDependencies : installConfigs . length > 0 ,
167
- reuseMachineInstall : ! isCIBuild ,
168
165
} ,
169
166
{
170
167
label : "unitTests" ,
@@ -186,7 +183,6 @@ module.exports = defineConfig({
186
183
} ,
187
184
} ,
188
185
skipExtensionDependencies : true ,
189
- reuseMachineInstall : ! isCIBuild ,
190
186
} ,
191
187
// you can specify additional test configurations, too
192
188
] ,
0 commit comments