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

Commit

Permalink
Drop dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
octref committed Mar 21, 2019
1 parent 26a6775 commit df9c929
Showing 1 changed file with 11 additions and 41 deletions.
52 changes: 11 additions & 41 deletions bin/test
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,6 @@ const fs = require('fs');

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

const version = process.env.CODE_VERSION || '<latest>';
const isInsiders = version === 'insiders';

const testRunFolder = path.join('.vscode-test', isInsiders ? 'vscode-insiders' : `vscode-${version}`);
const testRunFolderAbsolute = path.join(process.cwd(), testRunFolder);

let windowsExecutable;
let darwinExecutable;
let linuxExecutable;

if (isInsiders) {
windowsExecutable = path.join(testRunFolderAbsolute, 'Code - Insiders.exe');
darwinExecutable = path.join(testRunFolderAbsolute, 'Visual Studio Code - Insiders.app', 'Contents', 'MacOS', 'Electron');
linuxExecutable = path.join(testRunFolderAbsolute, 'VSCode-linux-x64', 'code-insiders');
} else {
windowsExecutable = path.join(testRunFolderAbsolute, 'Code.exe');
darwinExecutable = path.join(testRunFolderAbsolute, 'Visual Studio Code.app', 'Contents', 'MacOS', 'Electron');
linuxExecutable = path.join(testRunFolderAbsolute, 'VSCode-linux-x64', 'code');
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) {
linuxExecutable = path.join(testRunFolderAbsolute, 'VSCode-linux-x64', 'Code');
}
}

var testsFolder;
if (process.env.CODE_TESTS_PATH) {
testsFolder = process.env.CODE_TESTS_PATH;
Expand All @@ -42,12 +19,12 @@ var testsWorkspace = process.env.CODE_TESTS_WORKSPACE || testsFolder;
var extensionsFolder = process.env.CODE_EXTENSIONS_PATH || process.cwd();
var locale = process.env.CODE_LOCALE || 'en';
var userDataDir = process.env.CODE_TESTS_DATA_DIR;
var executable = (process.platform === 'darwin') ? darwinExecutable : process.platform === 'win32' ? windowsExecutable : linuxExecutable;

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

function runTests() {
function runTests(executablePath) {
var args = [
testsWorkspace,
'--extensionDevelopmentPath=' + extensionsFolder,
Expand All @@ -63,9 +40,9 @@ function runTests() {
args.push('--disable-extensions');
}

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

var cmd = cp.spawn(executable, args);
var cmd = cp.spawn(executablePath, args);

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

function downloadExecutableAndRunTests() {
console.log('Downloading VS Code into "' + testRunFolderAbsolute);

var targetVersion = (version === '<latest>') ? undefined : version;

downloadAndUnzipVSCode(targetVersion).then(executablePath => {
executable = executablePath
runTests()
downloadAndUnzipVSCode(process.env.CODE_VERSION).then(executablePath => {
runTests(executablePath)
}).catch(err => {
console.error('Failed to run test with error:')
console.log(err);
process.exit(1);
})
}

fs.exists(executable, function (exists) {
if (exists) {
runTests();
} else {
downloadExecutableAndRunTests();
}
});
downloadExecutableAndRunTests()

0 comments on commit df9c929

Please sign in to comment.