Skip to content

test: fix flaky Windows CI failure in nextjs-runtime-discovery teardown#142

Merged
gaojude merged 1 commit into
mainfrom
fix/flaky-afterall-hook-timeout-windows
Jun 1, 2026
Merged

test: fix flaky Windows CI failure in nextjs-runtime-discovery teardown#142
gaojude merged 1 commit into
mainfrom
fix/flaky-afterall-hook-timeout-windows

Conversation

@gaojude

@gaojude gaojude commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Problem

test/unit/nextjs-runtime-discovery.test.ts intermittently fails on windows-latest CI with:

Error: Hook timed out in 10000ms.
 ❯ test/unit/nextjs-runtime-discovery.test.ts:156  (afterAll)

All 38 tests pass — only the afterAll teardown trips. It kills the spawned Next.js dev server and then rm -rfs a temp dir containing a full node_modules; on Windows runners that cleanup takes ~14s, exceeding vitest's global hookTimeout (10000ms). ubuntu-latest is fast enough to slip under the limit, so it only flakes on Windows.

Fix

beforeAll already passes SERVER_STARTUP_TIMEOUT; give afterAll an explicit CLEANUP_TIMEOUT (60s) so teardown isn't capped by the 10s global hook timeout. Pure test-timeout change — no product code touched.

Verification

  • pnpm typecheckpnpm build ✅ affected test ✅ locally
  • Windows CI on this PR is the real proof (watching).

Discovered while CI flaked on an unrelated PR (#141).

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.
@gaojude gaojude enabled auto-merge (squash) June 1, 2026 03:31
@gaojude gaojude merged commit 4d51adf into main Jun 1, 2026
10 checks passed
@gaojude gaojude deleted the fix/flaky-afterall-hook-timeout-windows branch June 1, 2026 03:54
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