@@ -3,6 +3,7 @@ import * as path from 'path';
3
3
4
4
import { downloadAndUnzipVSCode , resolveCliArgsFromVSCodeExecutablePath , runTests } from '@vscode/test-electron' ;
5
5
import { PVSC_EXTENSION_ID_FOR_TESTS } from './constants' ;
6
+ import { getOSType } from '../extension/common/platform' ;
6
7
7
8
async function main ( ) {
8
9
try {
@@ -13,24 +14,29 @@ async function main() {
13
14
// The path to test runner
14
15
// Passed to --extensionTestsPath
15
16
const extensionTestsPath = path . resolve ( __dirname , './unittest/index' ) ;
16
-
17
17
const vscodeExecutablePath = await downloadAndUnzipVSCode ( 'stable' ) ;
18
18
console . log ( "vscodeExecutablePath: " , vscodeExecutablePath ) ;
19
19
const [ cliPath , ...args ] = resolveCliArgsFromVSCodeExecutablePath ( vscodeExecutablePath ) ;
20
20
console . log ( "cliPath: " , cliPath ) ;
21
21
console . log ( "args: " , args ) ;
22
- const exec = path . basename ( cliPath ) ;
23
- console . log ( "Base: " , exec ) ;
24
-
25
- console . log ( "Base 2: " , path . dirname ( cliPath ) ) ;
26
-
27
22
28
- // Use cp.spawn / cp.exec for custom setup
29
- cp . spawnSync ( exec , [ ...args , '--install-extension' , PVSC_EXTENSION_ID_FOR_TESTS ] , {
30
- cwd : path . dirname ( cliPath ) ,
31
- encoding : 'utf-8' ,
32
- stdio : 'inherit' ,
33
- } ) ;
23
+ if ( getOSType ( ) == "Windows" ) {
24
+ const exec = path . basename ( cliPath ) ;
25
+ console . log ( "Base: " , exec ) ;
26
+ console . log ( "Base 2: " , path . dirname ( cliPath ) ) ;
27
+
28
+ cp . spawnSync ( exec , [ ...args , '--install-extension' , PVSC_EXTENSION_ID_FOR_TESTS ] , {
29
+ cwd : path . dirname ( cliPath ) ,
30
+ encoding : 'utf-8' ,
31
+ stdio : 'inherit' ,
32
+ } ) ;
33
+
34
+ } else {
35
+ cp . spawnSync ( cliPath , [ ...args , '--install-extension' , PVSC_EXTENSION_ID_FOR_TESTS ] , {
36
+ encoding : 'utf-8' ,
37
+ stdio : 'inherit' ,
38
+ } ) ;
39
+ }
34
40
35
41
// Run the extension test
36
42
await runTests ( {
0 commit comments