Skip to content

Commit 5766db9

Browse files
committed
Set default higher timeout on CLI integration tests
This sets a default timeout of 3 minutes on CLI integration tests. This is because these tests call into the CLI and execute queries, so these are expected to take a lot longer than the default 5 seconds. This allows us to remove all the individual `jest.setTimeout` calls with different values from the test files.
1 parent 69c66f3 commit 5766db9

File tree

12 files changed

+3
-25
lines changed

12 files changed

+3
-25
lines changed

extensions/ql-vscode/test/vscode-tests/cli-integration/databaseFetcher.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ import {
1616
} from "../global.helper";
1717
import { createMockCommandManager } from "../../__mocks__/commandsMock";
1818

19-
jest.setTimeout(60_000);
20-
2119
/**
2220
* Run various integration tests for databases
2321
*/

extensions/ql-vscode/test/vscode-tests/cli-integration/helpers.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ import { CodeQLCliServer } from "../../../src/cli";
44
import { tryGetQueryMetadata } from "../../../src/helpers";
55
import { getActivatedExtension } from "../global.helper";
66

7-
// up to 3 minutes per test
8-
jest.setTimeout(3 * 60 * 1000);
9-
107
describe("helpers (with CLI)", () => {
118
const baseDir = __dirname;
129

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ const config: Config = {
66
...baseConfig,
77
runner: "<rootDir>/../jest-runner-installed-extensions.ts",
88
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
9+
// CLI integration tests call into the CLI and execute queries, so these are expected to take a lot longer
10+
// than the default 5 seconds.
11+
testTimeout: 180_000, // 3 minutes
912
};
1013

1114
export default config;

extensions/ql-vscode/test/vscode-tests/cli-integration/legacy-query.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,6 @@ const db: messages.Dataset = {
9898
workingSet: "default",
9999
};
100100

101-
jest.setTimeout(60_000);
102-
103101
describeWithCodeQL()("using the legacy query server", () => {
104102
const nullProgressReporter: ProgressReporter = {
105103
report: () => {

extensions/ql-vscode/test/vscode-tests/cli-integration/new-query.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ const nullProgressReporter: ProgressReporter = {
104104
},
105105
};
106106

107-
jest.setTimeout(20_000);
108-
109107
describeWithCodeQL()("using the new query server", () => {
110108
let qs: qsClient.QueryServerClient;
111109
let cliServer: cli.CodeQLCliServer;

extensions/ql-vscode/test/vscode-tests/cli-integration/packaging.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ import {
1212
import { mockedQuickPickItem } from "../utils/mocking.helpers";
1313
import { getActivatedExtension } from "../global.helper";
1414

15-
// up to 3 minutes per test
16-
jest.setTimeout(3 * 60 * 1000);
17-
1815
describe("Packaging commands", () => {
1916
let cli: CodeQLCliServer;
2017
const progress = jest.fn();

extensions/ql-vscode/test/vscode-tests/cli-integration/queries.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ import { QueryResultType } from "../../../src/pure/new-messages";
2727
import { createVSCodeCommandManager } from "../../../src/common/vscode/commands";
2828
import { AllCommands, QueryServerCommands } from "../../../src/common/commands";
2929

30-
jest.setTimeout(60_000);
31-
3230
/**
3331
* Integration tests for queries
3432
*/

extensions/ql-vscode/test/vscode-tests/cli-integration/run-cli.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ import { KeyType } from "../../../src/contextual/keyType";
1414
import { faker } from "@faker-js/faker";
1515
import { getActivatedExtension } from "../global.helper";
1616

17-
jest.setTimeout(60_000);
18-
1917
/**
2018
* Perform proper integration tests by running the CLI
2119
*/

extensions/ql-vscode/test/vscode-tests/cli-integration/skeleton-query-wizard.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ import * as databaseFetcher from "../../../src/databaseFetcher";
2222
import { createMockDB } from "../../factories/databases/databases";
2323
import { asError } from "../../../src/pure/helpers-pure";
2424

25-
jest.setTimeout(80_000);
26-
2725
describe("SkeletonQueryWizard", () => {
2826
let mockCli: CodeQLCliServer;
2927
let wizard: SkeletonQueryWizard;

extensions/ql-vscode/test/vscode-tests/cli-integration/sourcemap.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import { readFile, writeFile, ensureDir, copy } from "fs-extra";
55
import { createVSCodeCommandManager } from "../../../src/common/vscode/commands";
66
import { AllCommands } from "../../../src/common/commands";
77

8-
jest.setTimeout(20_000);
9-
108
/**
119
* Integration tests for queries
1210
*/

0 commit comments

Comments
 (0)