Skip to content

test(nextjs): Warm the module graph before the tunnel route tests - #25593

Merged
nicohrubec merged 1 commit into
developfrom
isaacschlueter/js-3977-flaky-test-maybesetuptunnelrouterewriterules-times-out-on
Oct 21, 2026
Merged

nicohrubec merged 1 commit into
developfrom
isaacschlueter/js-3977-flaky-test-maybesetuptunnelrouterewriterules-times-out-on

Conversation

@isaacs

@isaacs isaacs commented Oct 21, 2026

Copy link
Copy Markdown
Member

The first test in getFinalConfigObjectUtils.test.ts paid for the cold transform of the module and its dependency tree. On a slow CI runner this took more than the 5 second test timeout. Vitest does not stop a timed-out test, so its late console.log went into the next test's spy, and two tests failed.

A beforeAll hook now imports the module once. vi.resetModules() clears the module registry but keeps the transform cache, so later imports are fast. The slow work runs in the hook, which has its own timeout and cannot leak into a test.

A longer test timeout would also pass, but a slow first test could still break the next one.

Fixes #25591
Fixes JS-3977

The first test in `getFinalConfigObjectUtils.test.ts` paid for the cold
transform of the module and its dependency tree. On a slow CI runner
this took more than the 5 second test timeout. Vitest does not stop a
timed-out test, so its late `console.log` went into the next test's
spy, and two tests failed.

A `beforeAll` hook now imports the module once. `vi.resetModules()`
clears the module registry but keeps the transform cache, so later
imports are fast. The slow work runs in the hook, which has its own
timeout and cannot leak into a test.

A longer test timeout would also pass, but a slow first test could
still break the next one.

Fixes #25591
Fixes JS-3977

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@isaacs
isaacs requested a review from a team as a code owner October 21, 2026 02:06
@isaacs
isaacs requested review from chargome and s1gr1d and removed request for a team October 21, 2026 02:06
@linear-code

linear-code Bot commented Oct 21, 2026

Copy link
Copy Markdown

JS-3977

@nicohrubec nicohrubec left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@nicohrubec
nicohrubec merged commit 7b89f63 into develop Oct 21, 2026
175 of 176 checks passed
@nicohrubec
nicohrubec deleted the isaacschlueter/js-3977-flaky-test-maybesetuptunnelrouterewriterules-times-out-on branch October 21, 2026 08:06
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.

Flaky test: maybeSetUpTunnelRouteRewriteRules times out on slow CI runners

2 participants