@@ -2,8 +2,7 @@ import * as cp from 'child_process';
22import  *  as  path  from  'path' ; 
33
44import  {  downloadAndUnzipVSCode ,  resolveCliArgsFromVSCodeExecutablePath ,  runTests  }  from  '@vscode/test-electron' ; 
5- import  {  PVSC_EXTENSION_ID_FOR_TESTS  }  from  './constants' ; 
6- import  {  OSType ,  getOSType  }  from  '../extension/common/platform' ; 
5+ import  {  PVSC_ENVS_EXTENSION_ID_FOR_TESTS ,  PVSC_EXTENSION_ID_FOR_TESTS  }  from  './constants' ; 
76
87async  function  main ( )  { 
98    try  { 
@@ -18,19 +17,49 @@ async function main() {
1817        const  [ cliPath ,  ...args ]  =  resolveCliArgsFromVSCodeExecutablePath ( vscodeExecutablePath ) ; 
1918
2019        // Use cp.spawn / cp.exec for custom setup 
21-         if  ( getOSType ( )  ===  OSType . Windows )  { 
22-             const  exec  =  path . basename ( cliPath ) ; 
23-             cp . spawnSync ( exec ,  [ ...args ,  '--install-extension' ,  PVSC_EXTENSION_ID_FOR_TESTS ] ,  { 
24-                 cwd : path . dirname ( cliPath ) , 
25-                 encoding : 'utf-8' , 
26-                 stdio : 'inherit' , 
27-             } ) ; 
20+         const  isWin  =  process . platform  ===  'win32' ; 
21+         if  ( isWin )  { 
22+             try  { 
23+                 const  installResult  =  cp . spawnSync ( 
24+                     cliPath , 
25+                     [ ...args ,  '--install-extension' ,  PVSC_EXTENSION_ID_FOR_TESTS ,  PVSC_ENVS_EXTENSION_ID_FOR_TESTS ] , 
26+                     { 
27+                         cwd : path . dirname ( cliPath ) , 
28+                         encoding : 'utf8' , 
29+                         stdio : 'inherit' , 
30+                         shell : true , 
31+                     } , 
32+                 ) ; 
33+                 if  ( installResult . error )  { 
34+                     console . error ( 'Extension installation error:' ,  installResult . error ) ; 
35+                 } 
36+                 if  ( installResult . status  !==  0 )  { 
37+                     console . error ( `Extension installation failed with exit code: ${ installResult . status }  ) ; 
38+                 }  else  { 
39+                     console . log ( 'Extension installation succeeded.' ) ; 
40+                 } 
41+             }  catch  ( ex )  { 
42+                 console . error ( 'Exception during extension installation:' ,  ex ) ; 
43+             } 
2844        }  else  { 
29-             cp . spawnSync ( cliPath ,  [ ...args ,  '--install-extension' ,  PVSC_EXTENSION_ID_FOR_TESTS ] ,  { 
30-                 encoding : 'utf-8' , 
31-                 stdio : 'inherit' , 
32-             } ) ; 
45+             const  installResult  =  cp . spawnSync ( 
46+                 cliPath , 
47+                 [ ...args ,  '--install-extension' ,  PVSC_EXTENSION_ID_FOR_TESTS ,  PVSC_ENVS_EXTENSION_ID_FOR_TESTS ] , 
48+                 { 
49+                     encoding : 'utf8' , 
50+                     stdio : 'inherit' , 
51+                 } , 
52+             ) ; 
53+             if  ( installResult . error )  { 
54+                 console . error ( 'Extension installation error:' ,  installResult . error ) ; 
55+             } 
56+             if  ( installResult . status  !==  0 )  { 
57+                 console . error ( `Extension installation failed with exit code: ${ installResult . status }  ) ; 
58+             }  else  { 
59+                 console . log ( 'Extension installation succeeded.' ) ; 
60+             } 
3361        } 
62+         console . log ( 'Extensions installed, ready to run tests.' ) ; 
3463
3564        // Run the extension test 
3665        await  runTests ( { 
0 commit comments