1515const { defineConfig } = require ( "@vscode/test-cli" ) ;
1616const path = require ( "path" ) ;
1717const { version, publisher, name } = require ( "./package.json" ) ;
18+ const { preview } = require ( "./scripts/versions" ) ;
1819
1920const isCIBuild = process . env [ "CI" ] === "1" ;
2021const isFastTestRun = process . env [ "FAST_TEST_RUN" ] === "1" ;
@@ -40,19 +41,31 @@ if (dataDir) {
4041if ( process . platform === "darwin" && process . arch === "x64" ) {
4142 launchArgs . push ( "--disable-gpu" ) ;
4243}
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" ] ;
4453const install = [ ] ;
4554const installExtensions = [ "vadimcn.vscode-lldb" , "llvm-vs-code-extensions.lldb-dap" ] ;
4655if ( vsixPath ) {
4756 if ( ! path . isAbsolute ( vsixPath ) ) {
4857 vsixPath = path . join ( __dirname , vsixPath ) ;
4958 }
5059 console . log ( "Installing " + vsixPath ) ;
60+ installExtensions . push ( vsixPath ) ;
61+ }
62+
63+ for ( const ext of installExtensions ) {
5164 install . push ( {
52- label : " installExtension" ,
53- installExtensions : installExtensions . concat ( vsixPath ? [ vsixPath ] : [ ] ) ,
65+ label : ` installExtension- ${ ext } ` ,
66+ installExtensions : [ ext ] ,
5467 launchArgs,
55- files : [ ] ,
68+ files : [ "dist/test/sleep.test.js" ] ,
5669 version : process . env [ "VSCODE_VERSION" ] ?? "stable" ,
5770 reuseMachineInstall : ! isCIBuild ,
5871 } ) ;
@@ -68,7 +81,7 @@ module.exports = defineConfig({
6881 workspaceFolder : "./assets/test" ,
6982 launchArgs,
7083 extensionDevelopmentPath : vsixPath
71- ? [ `${ __dirname } /.vscode-test/extensions/${ publisher } .${ name } -${ version } ` ]
84+ ? [ `${ __dirname } /.vscode-test/extensions/${ publisher } .${ name } -${ versionStr } ` ]
7285 : undefined ,
7386 env : {
7487 VSCODE_TEST : "1" ,
@@ -107,7 +120,7 @@ module.exports = defineConfig({
107120 workspaceFolder : "./assets/test.code-workspace" ,
108121 launchArgs,
109122 extensionDevelopmentPath : vsixPath
110- ? [ `${ __dirname } /.vscode-test/extensions/${ publisher } .${ name } -${ version } ` ]
123+ ? [ `${ __dirname } /.vscode-test/extensions/${ publisher } .${ name } -${ versionStr } ` ]
111124 : undefined ,
112125 env : {
113126 VSCODE_TEST : "1" ,
0 commit comments