@@ -6,29 +6,6 @@ const fs = require('fs');
6
6
7
7
const downloadAndUnzipVSCode = require ( 'vscode-test' ) . downloadAndUnzipVSCode ;
8
8
9
- const version = process . env . CODE_VERSION || '<latest>' ;
10
- const isInsiders = version === 'insiders' ;
11
-
12
- const testRunFolder = path . join ( '.vscode-test' , isInsiders ? 'vscode-insiders' : `vscode-${ version } ` ) ;
13
- const testRunFolderAbsolute = path . join ( process . cwd ( ) , testRunFolder ) ;
14
-
15
- let windowsExecutable ;
16
- let darwinExecutable ;
17
- let linuxExecutable ;
18
-
19
- if ( isInsiders ) {
20
- windowsExecutable = path . join ( testRunFolderAbsolute , 'Code - Insiders.exe' ) ;
21
- darwinExecutable = path . join ( testRunFolderAbsolute , 'Visual Studio Code - Insiders.app' , 'Contents' , 'MacOS' , 'Electron' ) ;
22
- linuxExecutable = path . join ( testRunFolderAbsolute , 'VSCode-linux-x64' , 'code-insiders' ) ;
23
- } else {
24
- windowsExecutable = path . join ( testRunFolderAbsolute , 'Code.exe' ) ;
25
- darwinExecutable = path . join ( testRunFolderAbsolute , 'Visual Studio Code.app' , 'Contents' , 'MacOS' , 'Electron' ) ;
26
- linuxExecutable = path . join ( testRunFolderAbsolute , 'VSCode-linux-x64' , 'code' ) ;
27
- if ( [ '0.10.1' , '0.10.2' , '0.10.3' , '0.10.4' , '0.10.5' , '0.10.6' , '0.10.7' , '0.10.8' , '0.10.9' ] . indexOf ( version ) >= 0 ) {
28
- linuxExecutable = path . join ( testRunFolderAbsolute , 'VSCode-linux-x64' , 'Code' ) ;
29
- }
30
- }
31
-
32
9
var testsFolder ;
33
10
if ( process . env . CODE_TESTS_PATH ) {
34
11
testsFolder = process . env . CODE_TESTS_PATH ;
@@ -42,12 +19,12 @@ var testsWorkspace = process.env.CODE_TESTS_WORKSPACE || testsFolder;
42
19
var extensionsFolder = process . env . CODE_EXTENSIONS_PATH || process . cwd ( ) ;
43
20
var locale = process . env . CODE_LOCALE || 'en' ;
44
21
var userDataDir = process . env . CODE_TESTS_DATA_DIR ;
45
- var executable = ( process . platform === 'darwin' ) ? darwinExecutable : process . platform === 'win32' ? windowsExecutable : linuxExecutable ;
46
22
47
23
console . log ( '### VS Code Extension Test Run ###' ) ;
24
+ console . log ( '' ) ;
48
25
console . log ( 'Current working directory: ' + process . cwd ( ) ) ;
49
26
50
- function runTests ( ) {
27
+ function runTests ( executablePath ) {
51
28
var args = [
52
29
testsWorkspace ,
53
30
'--extensionDevelopmentPath=' + extensionsFolder ,
@@ -63,9 +40,9 @@ function runTests() {
63
40
args . push ( '--disable-extensions' ) ;
64
41
}
65
42
66
- console . log ( 'Running extension tests: ' + [ executable , args . join ( ' ' ) ] . join ( ' ' ) ) ;
43
+ console . log ( 'Running extension tests: ' + [ executablePath , args . join ( ' ' ) ] . join ( ' ' ) ) ;
67
44
68
- var cmd = cp . spawn ( executable , args ) ;
45
+ var cmd = cp . spawn ( executablePath , args ) ;
69
46
70
47
cmd . stdout . on ( 'data' , function ( data ) {
71
48
console . log ( data . toString ( ) ) ;
@@ -89,20 +66,13 @@ function runTests() {
89
66
}
90
67
91
68
function downloadExecutableAndRunTests ( ) {
92
- console . log ( 'Downloading VS Code into "' + testRunFolderAbsolute ) ;
93
-
94
- var targetVersion = ( version === '<latest>' ) ? undefined : version ;
95
-
96
- downloadAndUnzipVSCode ( targetVersion ) . then ( executablePath => {
97
- executable = executablePath
98
- runTests ( )
69
+ downloadAndUnzipVSCode ( process . env . CODE_VERSION ) . then ( executablePath => {
70
+ runTests ( executablePath )
71
+ } ) . catch ( err => {
72
+ console . error ( 'Failed to run test with error:' )
73
+ console . log ( err ) ;
74
+ process . exit ( 1 ) ;
99
75
} )
100
76
}
101
77
102
- fs . exists ( executable , function ( exists ) {
103
- if ( exists ) {
104
- runTests ( ) ;
105
- } else {
106
- downloadExecutableAndRunTests ( ) ;
107
- }
108
- } ) ;
78
+ downloadExecutableAndRunTests ( )
0 commit comments