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.
This commit is contained in:
Koen Vlaswinkel
2023-04-14 10:46:33 +02:00
parent 69c66f3b53
commit 5766db9285
12 changed files with 3 additions and 25 deletions

View File

@@ -16,8 +16,6 @@ import {
} from "../global.helper";
import { createMockCommandManager } from "../../__mocks__/commandsMock";
jest.setTimeout(60_000);
/**
* Run various integration tests for databases
*/

View File

@@ -4,9 +4,6 @@ import { CodeQLCliServer } from "../../../src/cli";
import { tryGetQueryMetadata } from "../../../src/helpers";
import { getActivatedExtension } from "../global.helper";
// up to 3 minutes per test
jest.setTimeout(3 * 60 * 1000);
describe("helpers (with CLI)", () => {
const baseDir = __dirname;

View File

@@ -6,6 +6,9 @@ const config: Config = {
...baseConfig,
runner: "<rootDir>/../jest-runner-installed-extensions.ts",
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
// CLI integration tests call into the CLI and execute queries, so these are expected to take a lot longer
// than the default 5 seconds.
testTimeout: 180_000, // 3 minutes
};
export default config;

View File

@@ -98,8 +98,6 @@ const db: messages.Dataset = {
workingSet: "default",
};
jest.setTimeout(60_000);
describeWithCodeQL()("using the legacy query server", () => {
const nullProgressReporter: ProgressReporter = {
report: () => {

View File

@@ -104,8 +104,6 @@ const nullProgressReporter: ProgressReporter = {
},
};
jest.setTimeout(20_000);
describeWithCodeQL()("using the new query server", () => {
let qs: qsClient.QueryServerClient;
let cliServer: cli.CodeQLCliServer;

View File

@@ -12,9 +12,6 @@ import {
import { mockedQuickPickItem } from "../utils/mocking.helpers";
import { getActivatedExtension } from "../global.helper";
// up to 3 minutes per test
jest.setTimeout(3 * 60 * 1000);
describe("Packaging commands", () => {
let cli: CodeQLCliServer;
const progress = jest.fn();

View File

@@ -27,8 +27,6 @@ import { QueryResultType } from "../../../src/pure/new-messages";
import { createVSCodeCommandManager } from "../../../src/common/vscode/commands";
import { AllCommands, QueryServerCommands } from "../../../src/common/commands";
jest.setTimeout(60_000);
/**
* Integration tests for queries
*/

View File

@@ -14,8 +14,6 @@ import { KeyType } from "../../../src/contextual/keyType";
import { faker } from "@faker-js/faker";
import { getActivatedExtension } from "../global.helper";
jest.setTimeout(60_000);
/**
* Perform proper integration tests by running the CLI
*/

View File

@@ -22,8 +22,6 @@ import * as databaseFetcher from "../../../src/databaseFetcher";
import { createMockDB } from "../../factories/databases/databases";
import { asError } from "../../../src/pure/helpers-pure";
jest.setTimeout(80_000);
describe("SkeletonQueryWizard", () => {
let mockCli: CodeQLCliServer;
let wizard: SkeletonQueryWizard;

View File

@@ -5,8 +5,6 @@ import { readFile, writeFile, ensureDir, copy } from "fs-extra";
import { createVSCodeCommandManager } from "../../../src/common/vscode/commands";
import { AllCommands } from "../../../src/common/commands";
jest.setTimeout(20_000);
/**
* Integration tests for queries
*/

View File

@@ -29,9 +29,6 @@ import { QueryLanguage } from "../../../../src/common/query-language";
import { readBundledPack } from "../../utils/bundled-pack-helpers";
import { load } from "js-yaml";
// up to 3 minutes per test
jest.setTimeout(3 * 60 * 1000);
describe("Variant Analysis Manager", () => {
let cli: CodeQLCliServer;
let cancellationTokenSource: CancellationTokenSource;

View File

@@ -15,8 +15,6 @@ import { getActivatedExtension } from "../../global.helper";
import { createVSCodeCommandManager } from "../../../../src/common/vscode/commands";
import { AllCommands } from "../../../../src/common/commands";
jest.setTimeout(30_000);
const mockServer = new MockGitHubApiServer();
beforeAll(() => mockServer.startServer());
afterEach(() => mockServer.unloadScenario());