@@ -3,7 +3,6 @@ import * as path from 'path';
33
44import { downloadAndUnzipVSCode , resolveCliArgsFromVSCodeExecutablePath , runTests } from '@vscode/test-electron' ;
55import { PVSC_ENVS_EXTENSION_ID_FOR_TESTS , PVSC_EXTENSION_ID_FOR_TESTS } from './constants' ;
6- import { OSType , getOSType } from '../extension/common/platform' ;
76
87async function main ( ) {
98 try {
@@ -18,27 +17,48 @@ 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- console . log ( `Using ${ exec } to run tests` ) ;
24- cp . spawnSync (
25- exec ,
20+ const isWin = process . platform === 'win32' ;
21+ if ( isWin ) {
22+ console . log ( '[DEBUG] Windows detected' ) ;
23+ console . log ( '[DEBUG] cliPath:' , cliPath ) ;
24+ console . log ( '[DEBUG] args:' , args ) ;
25+ console . log ( '[DEBUG] cwd:' , path . dirname ( cliPath ) ) ;
26+ const installResult = cp . spawnSync (
27+ cliPath ,
2628 [ ...args , '--install-extension' , PVSC_EXTENSION_ID_FOR_TESTS , PVSC_ENVS_EXTENSION_ID_FOR_TESTS ] ,
2729 {
2830 cwd : path . dirname ( cliPath ) ,
29- encoding : 'utf-8 ' ,
31+ encoding : 'utf8 ' ,
3032 stdio : 'inherit' ,
33+ shell : true ,
3134 } ,
3235 ) ;
36+ console . log ( '[DEBUG] installResult:' , installResult ) ;
37+ if ( installResult . error ) {
38+ console . error ( 'Extension installation error:' , installResult . error ) ;
39+ }
40+ if ( installResult . status !== 0 ) {
41+ console . error ( `Extension installation failed with exit code: ${ installResult . status } ` ) ;
42+ }
3343 } else {
34- cp . spawnSync (
44+ console . log ( '[DEBUG] Non-Windows detected' ) ;
45+ console . log ( '[DEBUG] cliPath:' , cliPath ) ;
46+ console . log ( '[DEBUG] args:' , args ) ;
47+ const installResult = cp . spawnSync (
3548 cliPath ,
3649 [ ...args , '--install-extension' , PVSC_EXTENSION_ID_FOR_TESTS , PVSC_ENVS_EXTENSION_ID_FOR_TESTS ] ,
3750 {
38- encoding : 'utf-8 ' ,
51+ encoding : 'utf8 ' ,
3952 stdio : 'inherit' ,
4053 } ,
4154 ) ;
55+ console . log ( '[DEBUG] installResult:' , installResult ) ;
56+ if ( installResult . error ) {
57+ console . error ( 'Extension installation error:' , installResult . error ) ;
58+ }
59+ if ( installResult . status !== 0 ) {
60+ console . error ( `Extension installation failed with exit code: ${ installResult . status } ` ) ;
61+ }
4262 }
4363 console . log ( 'Extensions installed, ready to run tests.' ) ;
4464
0 commit comments