@@ -3,7 +3,6 @@ import * as path from 'path';
3
3
4
4
import { downloadAndUnzipVSCode , resolveCliArgsFromVSCodeExecutablePath , runTests } from '@vscode/test-electron' ;
5
5
import { PVSC_ENVS_EXTENSION_ID_FOR_TESTS , PVSC_EXTENSION_ID_FOR_TESTS } from './constants' ;
6
- import { OSType , getOSType } from '../extension/common/platform' ;
7
6
8
7
async function main ( ) {
9
8
try {
@@ -18,27 +17,48 @@ async function main() {
18
17
const [ cliPath , ...args ] = resolveCliArgsFromVSCodeExecutablePath ( vscodeExecutablePath ) ;
19
18
20
19
// 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 ,
26
28
[ ...args , '--install-extension' , PVSC_EXTENSION_ID_FOR_TESTS , PVSC_ENVS_EXTENSION_ID_FOR_TESTS ] ,
27
29
{
28
30
cwd : path . dirname ( cliPath ) ,
29
- encoding : 'utf-8 ' ,
31
+ encoding : 'utf8 ' ,
30
32
stdio : 'inherit' ,
33
+ shell : true ,
31
34
} ,
32
35
) ;
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
+ }
33
43
} 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 (
35
48
cliPath ,
36
49
[ ...args , '--install-extension' , PVSC_EXTENSION_ID_FOR_TESTS , PVSC_ENVS_EXTENSION_ID_FOR_TESTS ] ,
37
50
{
38
- encoding : 'utf-8 ' ,
51
+ encoding : 'utf8 ' ,
39
52
stdio : 'inherit' ,
40
53
} ,
41
54
) ;
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
+ }
42
62
}
43
63
console . log ( 'Extensions installed, ready to run tests.' ) ;
44
64
0 commit comments