Files
hyperframes/packages/cli/vitest.config.ts
T
James RussoandClaude Opus 4.8 438474c968 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>
2026-07-01 22:08:44 -07:00

33 lines
1.4 KiB
TypeScript

import { resolve } from "node:path";
import { defineConfig } from "vitest/config";
export default defineConfig({
resolve: {
alias: [
// Resolve the bare @hyperframes/core entry to TypeScript source, not built
// dist. The published dist intentionally omits runtime/entry.ts, so the
// dist build of loadHyperframeRuntimeSource() returns null — which makes
// studioServer.test.ts's runtime-source equality assertion diverge. Tests
// run under bun against source; subpath imports (@hyperframes/core/*) keep
// resolving via the package's export conditions.
{
find: /^@hyperframes\/core$/,
replacement: resolve(__dirname, "../core/src/index.ts"),
},
],
},
test: {
include: ["src/**/*.test.ts"],
// Many CLI tests cold-import a heavy command module graph via dynamic
// `import()` (e.g. render.js, auth/status.js, telemetry/system.js). Under
// the full parallel monorepo run (`bun run --filter '!@hyperframes/producer'
// test`) that cold load contends for CPU and routinely blows vitest's 5s
// default test timeout / 10s hook timeout on CI runners — a recurring
// flake that has failed unrelated PRs (see PRs #1843, #1850). These
// generous ceilings absorb the contention while still catching a genuine
// hang. Prefer this one config knob over per-test/per-hook timeout bandaids.
testTimeout: 20_000,
hookTimeout: 30_000,
},
});