This repository was archived by the owner on May 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrunTest.ts
65 lines (57 loc) · 2.58 KB
/
runTest.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import * as path from "path";
import {runTests} from "@vscode/test-electron";
async function runTestsOnWindows(extensionDevelopmentPath: string, extensionTestsPath: string, workspace: string) {
await runTests({
extensionDevelopmentPath,
extensionTestsPath,
version: "1.70.0",
platform: "win32-x64-archive", //Use win64 instead of win32 for testing Windows
launchArgs: [workspace, "--disable-extensions"],
});
}
async function runTestsOnNonWindows(extensionDevelopmentPath: string, extensionTestsPath: string, workspace: string) {
await runTests({
extensionDevelopmentPath,
extensionTestsPath,
launchArgs: [workspace, "--disable-extensions"],
});
}
async function main() {
try {
// The folder containing the Extension Manifest package.json
// Passed to `--extensionDevelopmentPath`
const extensionDevelopmentPath = path.resolve(__dirname, "../..");
// The path to test runner
// Passed to --extensionTestsPath
const codigaFileSuggestionsExtensionTestsPath = path.resolve(__dirname, "./codigaFileSuggestionsTestRunner");
const completionExtensionTestsPath = path.resolve(__dirname, "./completionTestRunner");
const utilsExtensionTestsPath = path.resolve(__dirname, "./utilsTestRunner");
const pythonWorkspace = path.resolve(__dirname, "../../test-fixtures/config-suggestions/python-workspace");
const javascriptWorkspace = path.resolve(__dirname, "../../test-fixtures/config-suggestions/javascript-workspace");
const typescriptWorkspace = path.resolve(__dirname, "../../test-fixtures/config-suggestions/typescript-workspace");
const testPathsToWorkspaces = [
//codiga.yml file suggestions
[codigaFileSuggestionsExtensionTestsPath, pythonWorkspace],
[codigaFileSuggestionsExtensionTestsPath, javascriptWorkspace],
[codigaFileSuggestionsExtensionTestsPath, typescriptWorkspace],
//Inline and shortcut completion
[completionExtensionTestsPath, pythonWorkspace],
//utils
[utilsExtensionTestsPath, pythonWorkspace]
];
if (process.platform === "win32") {
for (let testPathsToWorkspace of testPathsToWorkspaces) {
await runTestsOnWindows(extensionDevelopmentPath, testPathsToWorkspace[0], testPathsToWorkspace[1]);
}
} else {
// Download VS Code, unzip it and run the integration test
for (let testPathsToWorkspace of testPathsToWorkspaces) {
await runTestsOnNonWindows(extensionDevelopmentPath, testPathsToWorkspace[0], testPathsToWorkspace[1]);
}
}
} catch (err) {
console.error("Failed to run tests");
process.exit(1);
}
}
main();