test: fix flaky Windows CI failure in nextjs-runtime-discovery teardown#142
Merged
Merged
Conversation
The afterAll hook in nextjs-runtime-discovery.test.ts kills the spawned Next.js dev server and then rm -rf's a temp dir containing a full node_modules. On Windows CI runners that cleanup can take ~14s, exceeding vitest's global hookTimeout (10000ms), producing a flaky 'Hook timed out in 10000ms' failure even though all 38 tests pass. beforeAll already passes SERVER_STARTUP_TIMEOUT; give afterAll an explicit CLEANUP_TIMEOUT (60s) so teardown isn't capped by the global hook timeout.
feedthejim
approved these changes
Jun 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
test/unit/nextjs-runtime-discovery.test.tsintermittently fails on windows-latest CI with:All 38 tests pass — only the
afterAllteardown trips. It kills the spawned Next.js dev server and thenrm -rfs a temp dir containing a fullnode_modules; on Windows runners that cleanup takes ~14s, exceeding vitest's globalhookTimeout(10000ms). ubuntu-latest is fast enough to slip under the limit, so it only flakes on Windows.Fix
beforeAllalready passesSERVER_STARTUP_TIMEOUT; giveafterAllan explicitCLEANUP_TIMEOUT(60s) so teardown isn't capped by the 10s global hook timeout. Pure test-timeout change — no product code touched.Verification
pnpm typecheck✅pnpm build✅ affected test ✅ locallyDiscovered while CI flaked on an unrelated PR (#141).