Skip to content

test: raise unit-test timeout to 30s to eliminate flaky CI failures#57

Merged
Arthur742Ramos merged 1 commit into
mainfrom
arthur742ramos/stabilize-test-timeouts
Jun 11, 2026
Merged

test: raise unit-test timeout to 30s to eliminate flaky CI failures#57
Arthur742Ramos merged 1 commit into
mainfrom
arthur742ramos/stabilize-test-timeouts

Conversation

@Arthur742Ramos

Copy link
Copy Markdown
Owner

Summary

Raises the Vitest unit-test timeout from the 5s default to 30s (testTimeout and hookTimeout in vitest.config.ts).

Why

Several unit tests perform real git operations (git init/clone/commit) and filesystem fixture setup — e.g. flags-behavior, main-command.behavior, ask-command, clone-service, ingest.clone, repo-resolver-branch. Under load (busy CI runners, Windows, or running suites in parallel) these occasionally exceed the 5s default and fail with:

Error: Test timed out in 5000ms.

This surfaced as intermittent red on the Windows, Node 20 CI job (a rerun passed cleanly) and is reproducible locally by running two full suites concurrently. The failures are environmental — the same tests pass on rerun — not logic bugs.

Fix

Give unit tests headroom with a 30s timeout. Fast tests finish in milliseconds and are completely unaffected; only genuinely slow/contended tests benefit. This mirrors the approach already taken in vitest.e2e.config.ts (90s).

Verification

  • Full suite: 1100 passing, ~6.5s total wall time (unchanged — the timeout only matters for tests that would otherwise flake).
  • Ran the full suite 3× consecutively — stable every time.
  • Ran two full suites concurrently (the exact contention that produced the 5s flake) — both passed 1100/1100.
  • Typecheck clean.

🤖 Generated with Claude Code

Several unit tests do real git work (init/clone/commit) and filesystem
fixture setup. Under load — busy CI runners, Windows, or parallel suites —
these occasionally exceed Vitest's 5s default and fail with "Test timed out
in 5000ms", which has shown up as intermittent red on Windows CI and locally
when running suites concurrently. The failures are environmental, not logic
bugs (the same tests pass on rerun).

Raise testTimeout/hookTimeout to 30s in vitest.config.ts. Fast tests finish
in milliseconds and are unaffected; only genuinely slow/contended tests get
the headroom. Mirrors the approach already used in vitest.e2e.config.ts
(90s). Verified stable across repeated and concurrent full-suite runs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Arthur742Ramos Arthur742Ramos force-pushed the arthur742ramos/stabilize-test-timeouts branch from af72d8e to f498316 Compare June 11, 2026 19:04
@Arthur742Ramos Arthur742Ramos merged commit e3da5bd into main Jun 11, 2026
13 checks passed
@Arthur742Ramos Arthur742Ramos deleted the arthur742ramos/stabilize-test-timeouts branch June 11, 2026 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants