mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-03 04:38:33 +00:00
test(cli): de-flake cold-import tests under CI contention via vitest timeouts (#1855)
The CLI Test job (bun run --filter '!@hyperframes/producer' test) intermittently failed unrelated PRs (#1843, #1850) with `Test timed out in 5000ms` / `Hook timed out in 10000ms`. Root cause: multiple CLI tests cold-import a heavy command module graph via dynamic import() (render.js, auth/status.js, telemetry/system.js), which under the full parallel monorepo run contends for CPU and blows vitest's 5s/10s defaults on constrained runners. Not a product bug. Fix at the right altitude: set testTimeout 20s + hookTimeout 30s once in packages/cli/vitest.config.ts instead of per-test/per-hook bandaids, and remove the now-redundant explicit 30s beforeAll timeouts added in #1843. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
9ebb29354b
commit
438474c968
@@ -62,19 +62,16 @@ vi.mock("../browser/preflight.js", () => ({
|
||||
describe("renderLocal browser GPU config", () => {
|
||||
const savedEnv = new Map<string, string | undefined>();
|
||||
// Pre-resolve once. The first dynamic `import("./render.js")` in this file
|
||||
// cold-loads a heavy module graph (core + engine + producer, incl. linkedom)
|
||||
// and takes >5 s on Windows runners — and materially longer under the full
|
||||
// parallel monorepo test run, where it can exceed the default 10 s hook
|
||||
// timeout on a contended CI runner. Importing once in `beforeAll` keeps every
|
||||
// test fast and isolated; the explicit 30 s hook timeout absorbs cold-import
|
||||
// contention so this doesn't flake (the failure was a pre-existing
|
||||
// `Hook timed out in 10000ms`, reproducible on `main` under load).
|
||||
// cold-loads a heavy module graph (core + engine + producer, incl. linkedom),
|
||||
// slow under the parallel monorepo run — the generous hook timeout that
|
||||
// absorbs that contention now lives in vitest.config.ts (shared by all CLI
|
||||
// suites). Importing once in `beforeAll` keeps every test fast and isolated.
|
||||
let renderLocal: typeof import("./render.js").renderLocal;
|
||||
let resolveBrowserGpuForCli: typeof import("./render.js").resolveBrowserGpuForCli;
|
||||
|
||||
beforeAll(async () => {
|
||||
({ renderLocal, resolveBrowserGpuForCli } = await import("./render.js"));
|
||||
}, 30_000);
|
||||
});
|
||||
|
||||
function setEnv(key: string, value: string) {
|
||||
if (!savedEnv.has(key)) savedEnv.set(key, process.env[key]);
|
||||
@@ -420,12 +417,11 @@ describe("renderLocal browser GPU config", () => {
|
||||
describe("checkRenderResolutionPreflight", () => {
|
||||
let checkRenderResolutionPreflight: typeof import("./render.js").checkRenderResolutionPreflight;
|
||||
|
||||
// 30 s hook timeout: cold-importing render.js (heavy graph) can exceed the
|
||||
// default 10 s under parallel CI contention. See the note on the
|
||||
// "renderLocal browser GPU config" beforeAll above.
|
||||
// Cold-imports render.js (heavy graph); the generous hook timeout for parallel
|
||||
// CI contention lives in vitest.config.ts. See the note above.
|
||||
beforeAll(async () => {
|
||||
({ checkRenderResolutionPreflight } = await import("./render.js"));
|
||||
}, 30_000);
|
||||
});
|
||||
|
||||
// Dims must be read the same way the producer's compiler reads them:
|
||||
// `data-width` / `data-height` on the `[data-composition-id]` root.
|
||||
|
||||
Reference in New Issue
Block a user