From 531754c3faae60249ca0f9b2656b2e88d224a35a Mon Sep 17 00:00:00 2001 From: Andrii Arsenin Date: Thu, 1 Oct 2026 11:44:51 +0300 Subject: [PATCH] test(server): stop timing-dependent failures on busy ci runners - raise the jest test timeout to 30s: building the nest app in beforeAll can exceed the 5s default when all suites start at once - accept any run status when reading back a just-created run, since the scheduler may already have picked it up --- server/jest.config.js | 4 ++++ server/test/scenario.controller.spec.ts | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/server/jest.config.js b/server/jest.config.js index a166802..9d58577 100644 --- a/server/jest.config.js +++ b/server/jest.config.js @@ -12,4 +12,8 @@ module.exports = { '^@mozilla/readability$': '/test/__mocks__/readability.ts', }, testEnvironment: 'node', + // Each suite builds a full Nest app in beforeAll. That takes well under a + // second on an idle machine, but several seconds when every suite starts at + // once on a busy CI runner, past Jest's default 5 s. + testTimeout: 30_000, }; diff --git a/server/test/scenario.controller.spec.ts b/server/test/scenario.controller.spec.ts index d23cd5f..ada18ab 100644 --- a/server/test/scenario.controller.spec.ts +++ b/server/test/scenario.controller.spec.ts @@ -810,7 +810,10 @@ describe("ScenarioController", () => { .expect(200); expect(res.body.id).toBe(runId); - expect(res.body.status).toBe("pending"); + // The scheduler may already have picked the run up + expect(["pending", "in_progress", "pass", "fail"]).toContain( + res.body.status, + ); expect(Array.isArray(res.body.stepRuns)).toBe(true); expect(res.body.stepRuns[0]).toHaveProperty("scenarioStep"); expect(Array.isArray(res.body.logs)).toBe(true);