Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit df9c929

Browse files
committed
Drop dead code
1 parent 26a6775 commit df9c929

File tree

1 file changed

+11
-41
lines changed

1 file changed

+11
-41
lines changed

bin/test

+11-41
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,6 @@ const fs = require('fs');
66

77
const downloadAndUnzipVSCode = require('vscode-test').downloadAndUnzipVSCode;
88

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-
329
var testsFolder;
3310
if (process.env.CODE_TESTS_PATH) {
3411
testsFolder = process.env.CODE_TESTS_PATH;
@@ -42,12 +19,12 @@ var testsWorkspace = process.env.CODE_TESTS_WORKSPACE || testsFolder;
4219
var extensionsFolder = process.env.CODE_EXTENSIONS_PATH || process.cwd();
4320
var locale = process.env.CODE_LOCALE || 'en';
4421
var userDataDir = process.env.CODE_TESTS_DATA_DIR;
45-
var executable = (process.platform === 'darwin') ? darwinExecutable : process.platform === 'win32' ? windowsExecutable : linuxExecutable;
4622

4723
console.log('### VS Code Extension Test Run ###');
24+
console.log('');
4825
console.log('Current working directory: ' + process.cwd());
4926

50-
function runTests() {
27+
function runTests(executablePath) {
5128
var args = [
5229
testsWorkspace,
5330
'--extensionDevelopmentPath=' + extensionsFolder,
@@ -63,9 +40,9 @@ function runTests() {
6340
args.push('--disable-extensions');
6441
}
6542

66-
console.log('Running extension tests: ' + [executable, args.join(' ')].join(' '));
43+
console.log('Running extension tests: ' + [executablePath, args.join(' ')].join(' '));
6744

68-
var cmd = cp.spawn(executable, args);
45+
var cmd = cp.spawn(executablePath, args);
6946

7047
cmd.stdout.on('data', function (data) {
7148
console.log(data.toString());
@@ -89,20 +66,13 @@ function runTests() {
8966
}
9067

9168
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);
9975
})
10076
}
10177

102-
fs.exists(executable, function (exists) {
103-
if (exists) {
104-
runTests();
105-
} else {
106-
downloadExecutableAndRunTests();
107-
}
108-
});
78+
downloadExecutableAndRunTests()

0 commit comments

Comments
 (0)