From 283375c6c1b4bef089086f5e778c98eef5d325e9 Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Fri, 29 Nov 2024 09:32:18 +0000 Subject: [PATCH] Retry E2E tests on failure if running in CI. (#995) * Retry E2E tests in CI * newsfile --- changelog.d/995.misc | 1 + jest.config.ts | 1 + spec/setup-jest.ts | 2 ++ 3 files changed, 4 insertions(+) create mode 100644 changelog.d/995.misc create mode 100644 spec/setup-jest.ts diff --git a/changelog.d/995.misc b/changelog.d/995.misc new file mode 100644 index 00000000..51157da6 --- /dev/null +++ b/changelog.d/995.misc @@ -0,0 +1 @@ +Retry e2e tests in CI due to container creation flakiness. diff --git a/jest.config.ts b/jest.config.ts index c6f38e15..21432ec3 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -9,6 +9,7 @@ const config: Config = { // The root directory that Jest should scan for tests and modules within rootDir: "spec-lib", testTimeout: 60000, + setupFiles: ["/spec/setup-jest.js"], }; export default config; diff --git a/spec/setup-jest.ts b/spec/setup-jest.ts new file mode 100644 index 00000000..a5481961 --- /dev/null +++ b/spec/setup-jest.ts @@ -0,0 +1,2 @@ +// In CI, the network creation for the homerunner containers can race (https://github.com/matrix-org/complement/issues/720). +jest.retryTimes(process.env.CI ? 3 : 1); \ No newline at end of file