@@ -69,22 +69,25 @@ export async function prepareVSCodeAndExecuteTests(
6969
7070async function installExtensions ( extensionIds : string [ ] , vscodeCli : string , vscodeArgs : string [ ] ) : Promise < void > {
7171 for ( const extensionId of extensionIds ) {
72- vscodeArgs . push ( '--install-extension' , extensionId ) ;
73- }
74-
75- // Since we're using shell execute, spaces in the CLI path will get interpeted as args
76- // Therefore we wrap the CLI path in quotes as on MacOS the path can contain spaces.
77- const cliWrapped = `"${ vscodeCli } "` ;
78- console . log ( `${ cliWrapped } ${ vscodeArgs } ` ) ;
72+ const argsWithExtension = [ ...vscodeArgs , '--install-extension' , extensionId ] ;
73+
74+ // Since we're using shell execute, spaces in the CLI path will get interpeted as args
75+ // Therefore we wrap the CLI path in quotes as on MacOS the path can contain spaces.
76+ const cliWrapped = `"${ vscodeCli } "` ;
77+ console . log ( `${ cliWrapped } ${ argsWithExtension } ` ) ;
78+
79+ const result = cp . spawnSync ( cliWrapped , argsWithExtension , {
80+ encoding : 'utf-8' ,
81+ stdio : 'inherit' ,
82+ // Workaround as described in https://github.com/nodejs/node/issues/52554
83+ shell : true ,
84+ } ) ;
85+ if ( result . error || result . status !== 0 ) {
86+ throw new Error ( `Failed to install extensions: ${ JSON . stringify ( result ) } ` ) ;
87+ }
7988
80- const result = cp . spawnSync ( cliWrapped , vscodeArgs , {
81- encoding : 'utf-8' ,
82- stdio : 'inherit' ,
83- // Workaround as described in https://github.com/nodejs/node/issues/52554
84- shell : true ,
85- } ) ;
86- if ( result . error || result . status !== 0 ) {
87- throw new Error ( `Failed to install extensions: ${ JSON . stringify ( result ) } ` ) ;
89+ // Workaround for https://github.com/microsoft/vscode/issues/256031 to install extensions one at a time with a delay.
90+ await new Promise ( ( resolve ) => setTimeout ( resolve , 2000 ) ) ;
8891 }
8992
9093 console . log ( ) ;
0 commit comments