@@ -2,8 +2,7 @@ import * as cp from 'child_process';
2
2
import * as path from 'path' ;
3
3
4
4
import { 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' ;
7
6
8
7
async function main ( ) {
9
8
try {
@@ -18,19 +17,49 @@ 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
- 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
+ }
28
44
} 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
+ }
33
61
}
62
+ console . log ( 'Extensions installed, ready to run tests.' ) ;
34
63
35
64
// Run the extension test
36
65
await runTests ( {
0 commit comments