Skip to content

test: pin doctor's latest-version lookup; move two cold-import costs off the 5s unit test budget - #1063

Merged
admarble merged 1 commit into
mainfrom
test/doctor-version-pin-and-import-heavy-timeouts
Sep 15, 2026
Merged

admarble merged 1 commit into
mainfrom
test/doctor-version-pin-and-import-heavy-timeouts

Conversation

@admarble

@admarble admarble commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up from the #1062 review, where three unrelated test failures rotated through full-suite runs on main. Test-only; no source changes.

  • src/commands/doctor.test.ts — two scenario assertions (warns when jq is not installed, all checks pass when everything is installed and configured) depended on the live npm registry via checkVersionThorough(). They failed on 2026-09-15 because 2.15.1 had just been published while the branch under test still said 2.15.0. The module is now partially mocked (importOriginal + a pinned up-to-date result) — the same class of fix as test(agents-md): pin the package version in the per-stack snapshots so releases don't break them #1056's snapshot pin.
  • src/ui/tui/load.test.ts — the first loadTui() paid the cold Ink/React import (~5 s under full-suite load) inside a test with the unit project's 5 s testTimeout. The import is now warmed in beforeAll (60 s hookTimeout). loadTui() sets/restores NODE_ENV on every call regardless of the module cache, so the restore behaviour each test guards is unchanged.
  • src/commands/version-preflight.docs.test.ts — the one async test did an await import() of the manifest/version-check graph inside its 5 s budget. Hoisted to a static import (precedent: version-preflight.test.ts), paid at collection time.

No tolerance was widened: the unit project keeps its 5 s default, per the rationale in vitest.config.ts.

Verification

  • Targeted, twice: 55 passed / 55 (all three files).
  • Full suite: 316 files, 6400 passed, 0 failed (1 expected fail, 3 skipped). Prior runs today on main-equivalent trees showed 2–3 rotating failures each time (doctor ×2; batch-executor bug-label; version-preflight.docs; tui/load).
  • npm run lint clean; tsc --noEmit clean.

Mutation-verified: doctor pin — flipped the mocked result to latestVersion: "9.9.9-test", isOutdated: true; warns when jq is not installed and all checks pass when everything is installed and configured failed (2 failed / 47 skipped); restored.

The other two changes remove a timing dependency rather than gate a claim, so a deterministic mutation isn't available for them; the full-suite result above is the evidence.

🤖 Generated with Claude Code

…off the 5s unit test budget

Follow-up to the #1062 review, where three unrelated test failures rotated through full-suite runs on main:

- doctor.test.ts: two scenario assertions depended on the live npm registry via checkVersionThorough(), so they failed on the day 2.15.1 was published while the branch still said 2.15.0. The module is now partially mocked (importOriginal + a pinned up-to-date result), the same class of fix as #1056's snapshot pin.
- tui/load.test.ts: the first loadTui() paid the cold Ink/React import (~5 s under load) inside a test with the unit project's 5 s testTimeout. The import is now warmed in beforeAll (60 s hookTimeout); loadTui() sets/restores NODE_ENV on every call, so the restore behaviour each test guards is unchanged.
- version-preflight.docs.test.ts: the one async test did an await import() of the manifest/version-check graph inside its 5 s budget. Hoisted to a static import (precedent: version-preflight.test.ts), paid at collection time.

No tolerance was widened; the unit project keeps its 5 s default.

Claude-Session: https://claude.ai/code/session_01LKP1FKm7sK7PEegt7vWhaJ
Entire-Checkpoint: bd730d3b45a1
@admarble
admarble merged commit 2a5fec3 into main Sep 15, 2026
6 checks passed
@admarble
admarble deleted the test/doctor-version-pin-and-import-heavy-timeouts branch September 15, 2026 22:15
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.

1 participant