Skip to content

Commit ea1419a

Browse files
authored
Merge pull request #3234 from github/koesie10/remove-jest-runner-installed-extensions
Simplify custom Jest test runner
2 parents b67efee + 0534cb7 commit ea1419a

5 files changed

Lines changed: 23 additions & 68 deletions

File tree

extensions/ql-vscode/scripts/find-deadcode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function ignoreFile(file: string): boolean {
99
containsPath(".storybook", file) ||
1010
containsPath(join("src", "stories"), file) ||
1111
pathsEqual(
12-
join("test", "vscode-tests", "jest-runner-installed-extensions.ts"),
12+
join("test", "vscode-tests", "jest-runner-vscode-codeql-cli.ts"),
1313
file,
1414
) ||
1515
basename(file) === "jest.config.ts" ||

extensions/ql-vscode/test/vscode-tests/activated-extension/jest.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import baseConfig from "../jest.config.base";
44

55
const config: Config = {
66
...baseConfig,
7-
runner: "<rootDir>/../jest-runner-installed-extensions.ts",
7+
runner: "<rootDir>/../jest-runner-vscode-codeql-cli.ts",
88
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
99
};
1010

extensions/ql-vscode/test/vscode-tests/cli-integration/jest.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import baseConfig from "../jest.config.base";
44

55
const config: Config = {
66
...baseConfig,
7-
runner: "<rootDir>/../jest-runner-installed-extensions.ts",
7+
runner: "<rootDir>/../jest-runner-vscode-codeql-cli.ts",
88
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
99
// CLI integration tests call into the CLI and execute queries, so these are expected to take a lot longer
1010
// than the default 5 seconds.

extensions/ql-vscode/test/vscode-tests/jest-runner-installed-extensions.ts

Lines changed: 0 additions & 65 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import type * as JestRunner from "jest-runner";
2+
import VSCodeTestRunner from "jest-runner-vscode";
3+
import { ensureCli } from "./ensureCli";
4+
5+
export default class JestRunnerVscodeCodeqlCli extends VSCodeTestRunner {
6+
async runTests(
7+
tests: JestRunner.Test[],
8+
watcher: JestRunner.TestWatcher,
9+
onStart: JestRunner.OnTestStart,
10+
onResult: JestRunner.OnTestSuccess,
11+
onFailure: JestRunner.OnTestFailure,
12+
): Promise<void> {
13+
// The CLI integration tests require the CLI to be available. We do not want to install the CLI
14+
// when VS Code is already running because this will not give any feedback to the test runner. Instead,
15+
// we'll download the CLI now and pass the path to the CLI to VS Code.
16+
await ensureCli(true);
17+
18+
return super.runTests(tests, watcher, onStart, onResult, onFailure);
19+
}
20+
}

0 commit comments

Comments
 (0)