|
1 | 1 | // Copyright (c) Microsoft Corporation. |
2 | 2 | // Licensed under the MIT License. |
3 | 3 |
|
4 | | -import * as path from "path"; |
| 4 | +// NOTE: This code is borrowed under permission from: |
| 5 | +// https://github.com/microsoft/vscode-extension-samples/tree/main/helloworld-test-sample/src/test |
5 | 6 |
|
6 | | -import { runTests } from "vscode-test"; |
| 7 | +import * as path from "path"; |
7 | 8 |
|
8 | | -// tslint:disable-next-line: no-var-requires |
9 | | -const PackageJSON: any = require("../../package.json"); |
10 | | -const testExtensionId = `${PackageJSON.publisher}.${PackageJSON.name}`; |
| 9 | +import { runTests } from "@vscode/test-electron"; |
11 | 10 |
|
12 | 11 | async function main() { |
13 | 12 | try { |
14 | 13 | // The folder containing the Extension Manifest package.json |
15 | 14 | // Passed to `--extensionDevelopmentPath` |
16 | 15 | const extensionDevelopmentPath = path.resolve(__dirname, "../../"); |
17 | 16 |
|
18 | | - // The path to the extension test runner script |
| 17 | + // The path to the extension test script |
19 | 18 | // Passed to --extensionTestsPath |
20 | | - const extensionTestsPath = path.resolve(__dirname, "./testRunner"); |
| 19 | + const extensionTestsPath = path.resolve(__dirname, "./index"); |
21 | 20 |
|
22 | | - // Download VS Code, unzip it and run the integration test from the local directory. |
| 21 | + // Download VS Code, unzip it and run the integration test |
23 | 22 | await runTests({ |
24 | 23 | extensionDevelopmentPath, |
25 | 24 | extensionTestsPath, |
26 | | - launchArgs: [ |
27 | | - "--disable-extensions", |
28 | | - "--enable-proposed-api", testExtensionId, |
29 | | - "./test" |
30 | | - ], |
| 25 | + launchArgs: ["--disable-extensions", "./test"], |
| 26 | + // This is necessary because the tests fail if more than once |
| 27 | + // instance of Code is running. |
31 | 28 | version: "insiders" |
32 | 29 | }); |
33 | 30 | } catch (err) { |
34 | | - // tslint:disable-next-line:no-console |
35 | | - console.error(err); |
36 | 31 | // tslint:disable-next-line:no-console |
37 | 32 | console.error("Failed to run tests"); |
38 | 33 | process.exit(1); |
|
0 commit comments