Skip to content

Commit 3fc1970

Browse files
committed
Simplify custom Jest test runner
The custom Jest test runner was originally written to install the required extensions for the CLI integration tests. This is no longer necessary as of #3232, so we can remove all code that deals with downloading VS Code and installing extensions. The download of VS Code will now be handled by the base `VSCodeTestRunner`.
1 parent b67efee commit 3fc1970

4 files changed

Lines changed: 22 additions & 67 deletions

File tree

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)