Skip to content

Commit c882a9f

Browse files
committed
Only retry tests in CI
We introduced this change to help with reducing flakiness in CI [1]. This has a slightly different effect locally, where every failed test will output three times. This in turn makes it harder to read, especially when you have multiple failing tests. Since the original intent for this behaviour was to be used in CI, I'm proposing we disable it when the CI env variable isn't set. I've opted to set it for all jobs involving tests, just for consistency. I'm happy to limit it to just the places where it's required. [1]: #2059
1 parent 6bcfdda commit c882a9f

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ jobs:
199199
run: echo "cli-versions=$(cat ./extensions/ql-vscode/supported_cli_versions.json | jq -rc)" >> $GITHUB_OUTPUT
200200
outputs:
201201
cli-versions: ${{ steps.set-variables.outputs.cli-versions }}
202+
202203
cli-test:
203204
name: CLI Test
204205
runs-on: ${{ matrix.os }}

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ import * as tmp from "tmp";
55
import { realpathSync } from "fs-extra";
66
import { setStoragePath, storagePath } from "./global.helper";
77

8-
jest.retryTimes(3, {
9-
logErrorsBeforeRetry: true,
10-
});
8+
if (process.env.CI) {
9+
jest.retryTimes(3, {
10+
logErrorsBeforeRetry: true,
11+
});
12+
}
1113

1214
// create an extension storage location
1315
let removeStorage: tmp.DirResult["removeCallback"] | undefined;

extensions/ql-vscode/test/vscode-tests/jest.setup.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { env } from "vscode";
22
import { beforeEachAction } from "./test-config";
33

4-
jest.retryTimes(3, {
5-
logErrorsBeforeRetry: true,
6-
});
4+
if (process.env.CI) {
5+
jest.retryTimes(3, {
6+
logErrorsBeforeRetry: true,
7+
});
8+
}
79

810
beforeEach(async () => {
911
jest.spyOn(env, "openExternal").mockResolvedValue(false);

0 commit comments

Comments
 (0)