f7d487057c test(typed-routes): fix flaky tests by increasing retry timeout (#91923)
## Fixing a bug

### What?

Three tests in `test/e2e/app-dir/typed-routes/typed-routes.test.ts` were
intermittently failing with `Failed to retry within 3000ms`:

- `typed-routes › should generate route types correctly`
- `typed-routes › should have passing tsc after start`
- `typed-routes › should correctly convert custom route patterns from
path-to-regexp to bracket syntax`

### Why?

The test harness marks the dev server as "ready" when it sees `✓ Ready
in X` in stdout. However, the server logs this message _before_
completing the full initialization sequence in `start-server.ts` —
specifically before `getRequestHandlers()` resolves, which chains into
`setupDevBundler()`. Route type generation (`routes.d.ts`) only
completes inside `setupDevBundler`'s Watchpack `aggregated` event
handler.

The gap between the "Ready" log and actual `routes.d.ts` completion can
exceed 3000ms on loaded CI runners, causing the tests' `retry()` calls
to time out before the file exists.

A secondary issue in `should have passing tsc after start`: the test
called `next.stop()` immediately after the server was considered ready,
before `routes.d.ts` was written. This meant `tsc` ran against a project
missing the generated types, causing type errors even though the server
had been healthy.

### How?

- Increased the `retry()` timeout from the default 3000ms to 30000ms for
the three affected tests.
- Added a `retry()` guard in `should have passing tsc after start` to
wait for `routes.d.ts` to be present and correct _before_ stopping the
server. This ensures `tsc` sees complete generated types.

Verified by running the full test file 3 consecutive times locally with
`NEXT_SKIP_ISOLATE=1 NEXT_TEST_MODE=dev pnpm testheadless` — all passes,
all 5 tests green each run.

Co-authored-by: Tobias Koppers <[email protected]>
Co-authored-by: Claude <[email protected]>
2026-03-26 14:20:13 -07:00
2025-10-13 10:43:51 +02:00
2026-03-26 05:11:59 +00:00
…
…
2026-03-26 05:11:59 +00:00
2026-03-26 05:11:59 +00:00
…

Next.js logo

Next.js

Vercel logo NPM version License Join the community on GitHub

Getting Started

Used by some of the world's largest companies, Next.js enables you to create full-stack web applications by extending the latest React features, and integrating powerful Rust-based JavaScript tooling for the fastest builds.

Documentation

Visit https://nextjs.org/docs to view the full documentation.

Community

The Next.js community can be found on GitHub Discussions where you can ask questions, voice ideas, and share your projects with other people.

To chat with other community members you can join the Next.js Discord server.

Do note that our Code of Conduct applies to all Next.js community channels. Users are highly encouraged to read and adhere to it to avoid repercussions.

Contributing

Contributions to Next.js are welcome and highly appreciated. However, before you jump right into it, we would like you to review our Contribution Guidelines to make sure you have a smooth experience contributing to Next.js.

Good First Issues:

We have a list of good first issues that contain bugs that have a relatively limited scope. This is a great place for newcomers and beginners alike to get started, gain experience, and get familiar with our contribution process.


Security

If you believe you have found a security vulnerability in Next.js, we encourage you to responsibly disclose this and NOT open a public issue.

To participate in our Open Source Software Bug Bounty program, please email [email protected]. We will add you to the program and provide further instructions for submitting your report.

S
Description
The React Framework
Readme
2.4 GiB
Languages
JavaScript 55.6%
TypeScript 30%
Rust 12.9%
MDX 0.7%
CSS 0.7%