Skip to content

fix(#880): give the Ink render tests a local timeout above the unit project's 5s default - #882

Merged
admarble merged 1 commit into
mainfrom
feature/880-fix-test-app-test-tsx-s-ink-fake-timer-test-bl
Jul 30, 2026
Merged

admarble merged 1 commit into
mainfrom
feature/880-fix-test-app-test-tsx-s-ink-fake-timer-test-bl

Conversation

@admarble

Copy link
Copy Markdown
Contributor

Summary

App.test.tsx's stale-completedAt test failed under full-suite load with Test timed out in 5000ms (reported at 5100ms) while passing 4/4 in isolation in ~1s. Not a logic defect and not a wrong assertion — a timeout.

Neither Ink test file has an .integration. infix, so both land in the unit vitest project, which keeps vitest's 5s default. vitest.config.ts states that split deliberately:

Deliberately scoped to integration — the unit project keeps vitest's 5s default, where a slow test is a real signal. Files needing more override it locally.

So the sanctioned fix is a local override, which is what this is. Same class as #842, except the cost here is an in-process Ink render rather than a subprocess spawn — which is exactly why #842's fix (raising the integration project's timeout) never covered it.

Scope note: file-level, not just the observed test

#880's AC-3 names the advanceTimersByTimeAsync tests. This applies the override at file scope instead, because measurement says the class is wider: in isolation the other tests in these files take 180–640ms each, the same curve the 5100ms case sits on. Gating only the observed instance would leave the next-slowest test one bad scheduling window away from the same failure. The measurements are in the code comment so the widening is reviewable rather than silent.

Verification

Check Result
Failure is timeout-bound, not logic Forcing --testTimeout=150 reproduces Test timed out on exactly the render tests; they pass at the default in isolation
Override takes effect All 10 tests in both files pass with --testTimeout=150 forced globally
AC-2: unit default unchanged, no leak At --testTimeout=1, version-check.test.ts fails while both Ink files pass — the override is strictly file-scoped
vitest.config.ts Untouched (diff is the two test files only)
Build / lint Clean

AC coverage

AC Status
AC-1 — no timeout failure under load, via the documented local-override hatch Met
AC-2 — unit project's 5s default unchanged Met, verified empirically as above
AC-3 — sibling Ink + advanceTimersByTimeAsync tests get the same treatment Met, and deliberately exceeded: file scope covers all three flush tests plus their plain-render siblings
AC-4 — comment explains why >5s is needed Met — states the Ink-render cause, both measurements, and why file scope

Test plan

  • npx vitest run src/ui/tui/ → 43 passed
  • npx vitest run src/ui/tui/App.test.tsx src/ui/tui/ElapsedTimer.test.tsx --testTimeout=150 → 10 passed
  • npx vitest run … src/lib/version-check.test.ts --testTimeout=1 → the non-overridden file fails, the two overridden files pass
  • Full suite runs in CI on this PR

Found by QA on #871 / PR #876, where this was the only failure in an otherwise-green 4727-test run.

Closes #880

Generated with Claude Code

…roject's 5s

App.test.tsx's stale-completedAt test failed under full-suite load with
`Test timed out in 5000ms` (reported at 5100ms) while passing 4/4 in isolation
in ~1s. Not a logic defect and not a wrong assertion -- a timeout.

Cause: neither Ink test file has an `.integration.` infix, so both land in the
`unit` vitest project, which keeps vitest's 5s default. vitest.config.ts states
that split deliberately ("the `unit` project keeps vitest's 5s default, where a
slow test is a real signal. Files needing more override it locally") -- so the
sanctioned fix is a local override, which is what this is. Same class as #842,
except the cost here is an in-process Ink render rather than a subprocess spawn,
which is why #842's fix (raising the *integration* project's timeout) did not
cover it.

Applied at FILE scope via `vi.setConfig`, not to the single observed test.
Measured in isolation, the other tests in these files take 180-640ms each --
the same curve the 5100ms case sits on -- so gating only the observed instance
would leave the class open. This is broader than #880's AC-3, which names just
the `advanceTimersByTimeAsync` tests; the measurements are in the comment so the
widening is reviewable rather than silent.

vitest.config.ts is untouched, so the `unit` project's 5s default still applies
everywhere else (AC-2). Verified empirically rather than by assertion: at
`--testTimeout=1`, version-check.test.ts fails while both Ink files pass, so the
override is strictly file-scoped and does not leak.
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.

fix(test): App.test.tsx's Ink fake-timer test blows the unit project's 5s default under full-suite load (sibling of #842)

1 participant