aboutsummaryrefslogtreecommitdiff
path: root/editors/code/tests/runTests.ts
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/tests/runTests.ts')
-rw-r--r--editors/code/tests/runTests.ts46
1 files changed, 46 insertions, 0 deletions
diff --git a/editors/code/tests/runTests.ts b/editors/code/tests/runTests.ts
new file mode 100644
index 000000000..81600f6a8
--- /dev/null
+++ b/editors/code/tests/runTests.ts
@@ -0,0 +1,46 @@
1import * as path from 'path';
2import * as fs from 'fs';
3
4import { runTests } from 'vscode-test';
5
6async function main() {
7 try {
8 // The folder containing the Extension Manifest package.json
9 // Passed to `--extensionDevelopmentPath`
10 const extensionDevelopmentPath = path.resolve(__dirname, '../../');
11
12 // Minimum supported version.
13 const jsonData = fs.readFileSync(path.join(extensionDevelopmentPath, 'package.json'));
14 const json = JSON.parse(jsonData.toString());
15 let minimalVersion: string = json.engines.vscode;
16 if (minimalVersion.startsWith('^')) minimalVersion = minimalVersion.slice(1);
17
18 const launchArgs = ["--disable-extensions"];
19
20 // All test suites (either unit tests or integration tests) should be in subfolders.
21 const extensionTestsPath = path.resolve(__dirname, './unit/index');
22
23 // Run tests using the minimal supported version.
24 await runTests({
25 version: minimalVersion,
26 launchArgs,
27 extensionDevelopmentPath,
28 extensionTestsPath
29 });
30
31 // and the latest one
32 await runTests({
33 version: 'stable',
34 launchArgs,
35 extensionDevelopmentPath,
36 extensionTestsPath
37 });
38
39 } catch (err) {
40 // eslint-disable-next-line no-console
41 console.error('Failed to run tests', err);
42 process.exit(1);
43 }
44}
45
46main();