diff options
author | Aleksey Kladov <[email protected]> | 2020-05-23 15:39:04 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-05-23 15:39:04 +0100 |
commit | f4f5fca10175b8d5fdfa36563c103f81b2b0acd3 (patch) | |
tree | 456d16e30fb799f82f71cff4c7aa91b0248c0220 /editors/code/tests/runTests.ts | |
parent | 4cc2ff6e390b6d8015ed1d266425459268f6e0b0 (diff) | |
parent | 1797b665a4dd82ba176b319c850a8875df327a5d (diff) |
Merge pull request #4538 from vsrs/vscode_tests
vscode client side tests
Diffstat (limited to 'editors/code/tests/runTests.ts')
-rw-r--r-- | editors/code/tests/runTests.ts | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/editors/code/tests/runTests.ts b/editors/code/tests/runTests.ts new file mode 100644 index 000000000..22df80ad3 --- /dev/null +++ b/editors/code/tests/runTests.ts | |||
@@ -0,0 +1,43 @@ | |||
1 | import * as path from 'path'; | ||
2 | import * as fs from 'fs'; | ||
3 | |||
4 | import { runTests } from 'vscode-test'; | ||
5 | |||
6 | async function main() { | ||
7 | // The folder containing the Extension Manifest package.json | ||
8 | // Passed to `--extensionDevelopmentPath` | ||
9 | const extensionDevelopmentPath = path.resolve(__dirname, '../../'); | ||
10 | |||
11 | // Minimum supported version. | ||
12 | const jsonData = fs.readFileSync(path.join(extensionDevelopmentPath, 'package.json')); | ||
13 | const json = JSON.parse(jsonData.toString()); | ||
14 | let minimalVersion: string = json.engines.vscode; | ||
15 | if (minimalVersion.startsWith('^')) minimalVersion = minimalVersion.slice(1); | ||
16 | |||
17 | const launchArgs = ["--disable-extensions"]; | ||
18 | |||
19 | // All test suites (either unit tests or integration tests) should be in subfolders. | ||
20 | const extensionTestsPath = path.resolve(__dirname, './unit/index'); | ||
21 | |||
22 | // Run tests using the minimal supported version. | ||
23 | await runTests({ | ||
24 | version: minimalVersion, | ||
25 | launchArgs, | ||
26 | extensionDevelopmentPath, | ||
27 | extensionTestsPath | ||
28 | }); | ||
29 | |||
30 | // and the latest one | ||
31 | await runTests({ | ||
32 | version: 'stable', | ||
33 | launchArgs, | ||
34 | extensionDevelopmentPath, | ||
35 | extensionTestsPath | ||
36 | }); | ||
37 | } | ||
38 | |||
39 | main().catch(err => { | ||
40 | // eslint-disable-next-line no-console | ||
41 | console.error('Failed to run tests', err); | ||
42 | process.exit(1); | ||
43 | }); | ||