2
2
// Licensed under the MIT license.
3
3
4
4
import * as cp from "child_process" ;
5
+ import * as fs from "fs" ;
5
6
import * as os from "os" ;
6
7
import * as path from "path" ;
7
- import { downloadAndUnzipVSCode , resolveCliPathFromVSCodeExecutablePath , runTests } from "vscode- test" ;
8
+ import { downloadAndUnzipVSCode , resolveCliArgsFromVSCodeExecutablePath , runTests } from "@ vscode/ test-electron " ;
8
9
9
10
async function main ( ) : Promise < void > {
10
11
try {
12
+ // test fails in macOS since the limitation of path length
13
+ // See: https://github.com/microsoft/vscode/issues/86382#issuecomment-593765388
14
+ const userDir = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , "vscode-user" ) ) ;
11
15
const vscodeExecutablePath = await downloadAndUnzipVSCode ( ) ;
12
- const cliPath = resolveCliPathFromVSCodeExecutablePath ( vscodeExecutablePath ) ;
13
16
14
17
// Resolve redhat.java dependency
15
- cp . spawnSync ( cliPath , [ "--install-extension" , "redhat.java" ] , {
16
- encoding : "utf-8" ,
17
- stdio : "inherit" ,
18
+ const [ cli , ...args ] = resolveCliArgsFromVSCodeExecutablePath ( vscodeExecutablePath ) ;
19
+ cp . spawnSync ( cli , [ ...args , '--install-extension' , 'redhat.java' ] , {
20
+ encoding : 'utf-8' ,
21
+ stdio : 'inherit'
18
22
} ) ;
19
23
20
24
// The folder containing the Extension Manifest package.json
@@ -30,7 +34,7 @@ async function main(): Promise<void> {
30
34
extensionTestsPath : path . resolve ( __dirname , "./suite" ) ,
31
35
launchArgs : [
32
36
path . join ( __dirname , ".." , ".." , "test" , "java9" ) ,
33
- "--disable-workspace-trust" ,
37
+ `--user-data-dir= ${ userDir } ` ,
34
38
] ,
35
39
} ) ;
36
40
@@ -41,7 +45,7 @@ async function main(): Promise<void> {
41
45
extensionTestsPath : path . resolve ( __dirname , "./simple-suite" ) ,
42
46
launchArgs : [
43
47
path . join ( __dirname , ".." , ".." , "test" , "simple" ) ,
44
- "--disable-workspace-trust" ,
48
+ `--user-data-dir= ${ userDir } ` ,
45
49
] ,
46
50
} ) ;
47
51
@@ -52,7 +56,7 @@ async function main(): Promise<void> {
52
56
extensionTestsPath : path . resolve ( __dirname , "./maven-suite" ) ,
53
57
launchArgs : [
54
58
path . join ( __dirname , ".." , ".." , "test" , "maven" ) ,
55
- "--disable-workspace-trust" ,
59
+ `--user-data-dir= ${ userDir } ` ,
56
60
] ,
57
61
} ) ;
58
62
@@ -63,7 +67,7 @@ async function main(): Promise<void> {
63
67
extensionTestsPath : path . resolve ( __dirname , "./gradle-suite" ) ,
64
68
launchArgs : [
65
69
path . join ( __dirname , ".." , ".." , "test" , "gradle" ) ,
66
- "--disable-workspace-trust" ,
70
+ `--user-data-dir= ${ userDir } ` ,
67
71
] ,
68
72
} ) ;
69
73
@@ -74,7 +78,7 @@ async function main(): Promise<void> {
74
78
extensionTestsPath : path . resolve ( __dirname , "./invisible-suite" ) ,
75
79
launchArgs : [
76
80
path . join ( __dirname , ".." , ".." , "test" , "invisible" ) ,
77
- "--disable-workspace-trust" ,
81
+ `--user-data-dir= ${ userDir } ` ,
78
82
] ,
79
83
} ) ;
80
84
0 commit comments