15
15
const { defineConfig } = require ( "@vscode/test-cli" ) ;
16
16
const path = require ( "path" ) ;
17
17
const { version, publisher, name } = require ( "./package.json" ) ;
18
+ const { preview } = require ( "./scripts/versions" ) ;
18
19
19
20
const isCIBuild = process . env [ "CI" ] === "1" ;
20
21
const isFastTestRun = process . env [ "FAST_TEST_RUN" ] === "1" ;
@@ -40,19 +41,31 @@ if (dataDir) {
40
41
if ( process . platform === "darwin" && process . arch === "x64" ) {
41
42
launchArgs . push ( "--disable-gpu" ) ;
42
43
}
43
- let vsixPath = process . env [ "VSCODE_SWIFT_VSIX" ] ;
44
+ const isStableRun = process . env [ "VSCODE_VERSION" ] !== "insiders" ;
45
+ let versionStr = version ;
46
+ if ( ! isStableRun ) {
47
+ const segments = version . split ( "." ) . map ( v => parseInt ( v , 10 ) ) ;
48
+ versionStr = preview ( { major : segments [ 0 ] , minor : segments [ 1 ] , patch : segments [ 2 ] } ) ;
49
+ }
50
+ let vsixPath = isStableRun
51
+ ? process . env [ "VSCODE_SWIFT_VSIX" ]
52
+ : process . env [ "VSCODE_SWIFT_PRERELEASE_VSIX" ] ;
44
53
const install = [ ] ;
45
54
const installExtensions = [ "vadimcn.vscode-lldb" , "llvm-vs-code-extensions.lldb-dap" ] ;
46
55
if ( vsixPath ) {
47
56
if ( ! path . isAbsolute ( vsixPath ) ) {
48
57
vsixPath = path . join ( __dirname , vsixPath ) ;
49
58
}
50
59
console . log ( "Installing " + vsixPath ) ;
60
+ installExtensions . push ( vsixPath ) ;
61
+ }
62
+
63
+ for ( const ext of installExtensions ) {
51
64
install . push ( {
52
- label : " installExtension" ,
53
- installExtensions : installExtensions . concat ( vsixPath ? [ vsixPath ] : [ ] ) ,
65
+ label : ` installExtension- ${ ext } ` ,
66
+ installExtensions : [ ext ] ,
54
67
launchArgs,
55
- files : [ ] ,
68
+ files : [ "dist/test/sleep.test.js" ] ,
56
69
version : process . env [ "VSCODE_VERSION" ] ?? "stable" ,
57
70
reuseMachineInstall : ! isCIBuild ,
58
71
} ) ;
@@ -68,7 +81,7 @@ module.exports = defineConfig({
68
81
workspaceFolder : "./assets/test" ,
69
82
launchArgs,
70
83
extensionDevelopmentPath : vsixPath
71
- ? [ `${ __dirname } /.vscode-test/extensions/${ publisher } .${ name } -${ version } ` ]
84
+ ? [ `${ __dirname } /.vscode-test/extensions/${ publisher } .${ name } -${ versionStr } ` ]
72
85
: undefined ,
73
86
env : {
74
87
VSCODE_TEST : "1" ,
@@ -107,7 +120,7 @@ module.exports = defineConfig({
107
120
workspaceFolder : "./assets/test.code-workspace" ,
108
121
launchArgs,
109
122
extensionDevelopmentPath : vsixPath
110
- ? [ `${ __dirname } /.vscode-test/extensions/${ publisher } .${ name } -${ version } ` ]
123
+ ? [ `${ __dirname } /.vscode-test/extensions/${ publisher } .${ name } -${ versionStr } ` ]
111
124
: undefined ,
112
125
env : {
113
126
VSCODE_TEST : "1" ,
0 commit comments