Skip to content

Commit ec38bc4

Browse files
authored
1 parent 87c30b0 commit ec38bc4

6 files changed

Lines changed: 200 additions & 3 deletions

File tree

‎.gitignore‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ out
22
bin
33
server
44
node_modules
5-
.vscode-test
6-
vscode-java-debug-*.vsix
5+
.vscode-test/
6+
vscode-java-debug-*.vsix
7+
packages/

‎package-lock.json‎

Lines changed: 102 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,17 +363,19 @@
363363
"vscode:prepublish": "tsc -p ./",
364364
"compile": "tsc -watch -p ./",
365365
"postinstall": "node ./node_modules/vscode/bin/install",
366-
"test": "node ./node_modules/vscode/bin/test"
366+
"test": "node ./scripts/download-vscode-for-system-tests && node ./scripts/install-vsix-dependencies redhat.java && node ./scripts/install-vsix-dependencies vscode-java-debug-0.9.0.vsix && node ./scripts/run-vscode-tests"
367367
},
368368
"extensionDependencies": [
369369
"redhat.java"
370370
],
371371
"devDependencies": {
372372
"@types/mocha": "^2.2.32",
373373
"@types/node": "^6.0.40",
374+
"cross-env": "^5.2.0",
374375
"gulp": "^3.9.1",
375376
"gulp-tslint": "^8.1.2",
376377
"mocha": "^2.3.3",
378+
"shelljs": "^0.8.2",
377379
"tslint": "^5.7.0",
378380
"typescript": "^2.0.3",
379381
"vscode": "^1.1.6"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env node
2+
3+
const shell = require('shelljs');
4+
5+
// Downloads an instance of VS Code for tests
6+
7+
if (shell.test('-e', '.vscode-test')) {
8+
// Already downloaded the instance of vscode-test
9+
shell.echo(
10+
'Using already downloaded instance in ' + shell.pwd() + '/.vscode-test'
11+
);
12+
} else {
13+
shell.echo(
14+
'Invoking ' +
15+
shell.pwd() +
16+
'/node_modules/vscode/bin/test for downloading VS Code'
17+
);
18+
shell.exec('node ./node_modules/vscode/bin/test', { silent: true });
19+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/usr/bin/env node
2+
3+
const path = require('path');
4+
const shell = require('shelljs');
5+
const glob = require('glob');
6+
7+
// Installs a list of extensions passed on the command line
8+
var version = process.env.CODE_VERSION || '*';
9+
var isInsiders = version === 'insiders';
10+
11+
const testRunFolder = path.join(
12+
'.vscode-test',
13+
isInsiders ? 'insiders' : 'stable'
14+
);
15+
const testRunFolderAbsolute = path.join(process.cwd(), testRunFolder);
16+
const codeExecutives = glob.sync('./.vscode-test/**/bin/code');
17+
const windowsExecutable = codeExecutives[0].replace(/\//g, '\\');
18+
const darwinExecutable = codeExecutives[0] || path.join(
19+
testRunFolderAbsolute,
20+
'Visual Studio Code.app',
21+
'Contents',
22+
'Resources',
23+
'app',
24+
'bin',
25+
'code'
26+
);
27+
const linuxExecutable = codeExecutives[0] || path.join(
28+
testRunFolderAbsolute,
29+
'VSCode-linux-x64',
30+
'bin',
31+
'code'
32+
);
33+
34+
const extensionsDir = path.join(__dirname, '..', 'packages');
35+
36+
const executable =
37+
process.platform === 'darwin'
38+
? darwinExecutable
39+
: process.platform === 'win32' ? windowsExecutable : linuxExecutable;
40+
41+
if (process.platform === 'linux') {
42+
// Somehow the code executable doesn't have +x set on the autobuilds -- set it here
43+
shell.chmod('+x', `${executable}`);
44+
}
45+
46+
// We always invoke this script with 'node install-vsix-dependencies arg'
47+
// so position2 is where the first argument is
48+
for (let arg = 2; arg < process.argv.length; arg++) {
49+
if (process.platform === 'win32') {
50+
// Windows Powershell doesn't like the single quotes around the executable
51+
shell.exec(
52+
`${executable} --extensions-dir ${extensionsDir} --install-extension ${process.argv[arg]}`
53+
);
54+
} else {
55+
shell.exec(
56+
`'${executable}' --extensions-dir ${extensionsDir} --install-extension ${process.argv[arg]}`
57+
);
58+
}
59+
}

‎scripts/run-vscode-tests.js‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env node
2+
3+
const shell = require('shelljs');
4+
shell.set('-e');
5+
shell.set('+v');
6+
7+
const path = require('path');
8+
shell.exec(
9+
`cross-env CODE_EXTENSIONS_PATH='${path.join(
10+
__dirname,
11+
'..',
12+
'packages'
13+
)}' node ./node_modules/vscode/bin/test`
14+
);

0 commit comments

Comments
 (0)