182 Commits

Author SHA1 Message Date
JJ Kasper 683180bfb3 Centralize test timings to fix shard divergence in CI (#90672)
## Summary

For context we discovered jobs were not reliably always running in
https://github.com/vercel/next.js/pull/90668 as addapters + turbopack
group ran more tests than just turbopack group.

- Each sharded test sub-job independently fetched test timings from KV
via a turbo task. Because turbo cache keys can vary across job groups
and KV can return slightly different data at different times, the
sharding algorithm produced different test-to-shard assignments across
groups — causing some tests to be missing entirely and others to run in
multiple shards.

- Adds a `--require-timings` flag to `run-tests.js` that fails loudly if
`test-timings.json` can't be loaded from disk, preventing silent
fallback to KV or round-robin.

- Adds a `testTimingsArtifact` input to `build_reusable.yml` that
downloads a pre-built timings artifact instead of fetching via turbo.
When unset (default), existing behavior is preserved.

- In both `test_e2e_deploy_release.yml` and `build_and_test.yml`,
timings are now fetched once in a setup job, uploaded as a GitHub
artifact, and downloaded by all sub-jobs — guaranteeing identical shard
assignments across all job groups.

## Test plan

- [ ] Verify `build_and_test.yml` jobs pick up the shared `test-timings`
artifact
- [ ] Verify `test_e2e_deploy_release.yml` deploy jobs pick up the
shared `test-timings` artifact
- [ ] Verify workflows that don't pass `testTimingsArtifact` (e.g.
`integration_tests_reusable.yml`, `pull_request_stats.yml`) still use
the turbo fallback path unchanged
2026-02-28 00:15:43 +00:00
JJ Kasper ce738b9f8c Disable jest cache for CI instead of wiping (#90097)
This is aiming to fix sporadic failures from jest transforms which is
most likely caused by the change to output to custom jest-cache folder
and wipe that between runs. Instead this disables the cache via
`--no-cache` flag and also fixes WASM bindings issue that started due to
cache not being available.

x-ref:
https://github.com/vercel/next.js/actions/runs/22109996356/job/63903450669?pr=90096#step:35:493
x-ref:
https://github.com/vercel/next.js/actions/runs/22109996356/job/63903820197?pr=90096#step:35:18167
2026-02-17 10:34:54 -08:00
Jiwon Choi 6adedb5e39 [test] Add test suite name for Tests failures table (#89258) 2026-01-29 21:53:05 +01:00
Sebastian "Sebbie" Silbermann a04499797e Re-enable types-and-precompiled (#89070) 2026-01-26 23:19:43 +00:00
Hendrik Liebau 71f9bda3cd [ci] Fix Rspack/Turbopack test manifest generation (#88845)
The recent change to always run all tests without aborting on failure
(#88435) inadvertently broke manifest generation. Previously, test
output was emitted for all tests when `NEXT_TEST_CONTINUE_ON_ERROR` was
set, but that variable was removed. Now test output is only emitted for
failing tests, causing the manifest to lose all passing test entries.

This adds a new `NEXT_TEST_EMIT_ALL_OUTPUT` environment variable that
restores the full output behavior specifically for the manifest
generation workflows.
2026-01-21 07:11:58 -08:00
Hendrik Liebau 2af84065cb [test] Always run all tests without aborting on failure (#88435)
It's more useful and efficient to run all tests and report all failures
instead of aborting on the first failure. This way, developers get a
complete picture of what needs to be fixed in a single run, and don't
have to go through multiple iterations of fixing one failure at a time.
2026-01-13 12:37:29 +01:00
Hendrik Liebau e04dad29a9 [test] Remove obsolete reference to NEXT_TEST_SKIP_RETRY_MANIFEST (#88434)
The manifest is not used anymore as of #76361.
2026-01-12 20:04:41 +01:00
Hendrik Liebau 7a2f4ad140 Type-check run-tests.js and remove unused related flag (#88433)
The file already had the `@ts-check` directive, so the IDE did show errors in that file. But since it was not included in the root `tsconfig.json`, those errors were not reported during CI runs.

One issue found this way was that the `related` flag was defined but never used. The referenced script was removed in #67644.
2026-01-12 19:46:11 +01:00
Jimmy Lai f3ccca39c7 chore: warn when running tests against stale build (#88001)
i got bit by this often :p 

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the PR.
- Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to understand the PR)
- When linking to a Slack thread, you might want to share details of the conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->
2026-01-05 13:26:58 +01:00
nextjs-bot 1c09f4494b Upgrade React from b45bb335-20251211 to f93b9fd4-20251217 (#87281) 2025-12-18 00:10:32 +00:00
Sebastian "Sebbie" Silbermann 435000f407 Upgrade React from 55480b4d-20251208 to 80cb7a99-20251211 (#87078) 2025-12-11 22:05:41 +01:00
nextjs-bot 6ef90ef49f Upgrade React from fd524fe0-20251121 to 7dc903cd-20251203 (#86771) 2025-12-03 16:20:59 +00:00
Sebastian "Sebbie" Silbermann bfb4a8c952 [test] Enable Playwright traces in deploy tests (#86683) 2025-12-01 14:33:57 +01:00
Sebastian "Sebbie" Silbermann e2554bc554 [test] Let pending test finish on abort (#86307) 2025-11-24 09:59:33 +00:00
JJ Kasper 62590c4081 Update E2E tests workflow (#85485)
Adds an option to allow continuing tests on error to find all failures
in single run also marks jobs as failed if any test failed while
running.
2025-10-28 17:35:14 -07:00
Jiwon Choi cf76c5b72d Update test/CNA templates React version to 19.2.0 (#84736)
The peerDeps are already bumped to 19.2.0 at
https://github.com/vercel/next.js/pull/84463, but the test/CNA templates
weren't updated as the `syncPagesRouterReact` value is always false at
the moment, which blocked the update.

Therefore, remove the `syncPagesRouterReact` condition to match the
actual peerDeps bump.

---------

Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Co-authored-by: Sebastian Sebbie Silbermann <sebastian.silbermann@vercel.com>
2025-10-13 10:10:10 +00:00
Benjamin Woodruff 0b74ff9b2b feat: Acquire a lockfile on distDir in next dev and next build (#84428)
https://github.com/vercel/next.js/pull/83961 lets you run both `next dev` and `next build` at the same time, however it's still problematic to run two instances of `next dev` or two instances of `next build` at the same time with the same `distDir`.

This sort of thing can happen to anyone by accident, but we've seen reports of this sort of behavior with AI agents.

https://github.com/vercel/next.js/pull/84378 adds a lockfile around just the persistent cache database in Turbopack, which helps, but it's not the only reason this is problematic, so we also need a lock around all of Next.js itself.

I was not able to find a cross-platform lockfile implementation in node that I felt was of sufficient quality, so on POSIX platforms this uses the recently-stabilized Rust stdlib implementation, which appears to be derived from rustc's own lockfile implementation, which has seen widespread use/deployment.

On Windows, since we'd rather have an advisory lock than a mandatory one, this emulates that by instead opening a file with write permissions, and a sharing mode that prohibits shared write access. That means that other processes can safely read the (empty) lockfile without blowing up.

<img width="500" src="https://github.com/user-attachments/assets/1ee4a6c6-2280-4f64-8bf2-ec5369c26db1" />
<img width="500" src="https://github.com/user-attachments/assets/2b04b566-c0b4-42ce-af34-912f3f6afa72" />

Tested on Windows as well:

<img width="1224" height="690" alt="Screenshot 2025-10-07 at 5 44 33 PM" src="https://github.com/user-attachments/assets/e36085b6-9c32-40ac-aca6-4c83e2a53842" />
2025-10-08 10:52:17 -07:00
Zack Tanner 99e09714e4 CI: use KV for test timing data (#83745)
Next.js tests are grouped based on timing data to better distribute them
for parallelization.

Previously this relied on a gist file that we would write to in CI.
However, this has more recently started resulting in 401s.

The actual reason for the 401s is the Turbo task wasn't propagating the
required environment variable to the task. It was mostly working by
accident, because we would store timing data on disk for the runner,
which would have been satisfied by a job that ran before it.

However despite that, relying on a gist file to read/write timing data
didn't feel like the write abstraction. I decided to refactor it to use
KV instead.

This also makes the handling more resilient to missing timing data. We
shouldn't fail the build if we can't fetch timings, as there's already
handling to fallback to round robin.
2025-09-12 15:13:50 -07:00
Hendrik Liebau eadcd5435d [test] Improve debug logs for Playwright tests (#83431) 2025-09-04 15:19:17 +02:00
Wyatt Johnson 8c0737d76d perf(router): replace LRU cache with optimized doubly-linked list implementation (#82633)
### What?

Replace LRU cache implementation with an optimized doubly-linked list
algorithm and move from server-only to shared library location.

### Why?

The previous Map-based LRU cache had suboptimal eviction performance for
route matching operations under high load. Route matching is a critical
performance path in Next.js that benefits significantly from true O(1)
cache operations.

### How?

- Implement doubly-linked list with sentinel nodes for true O(1)
get/set/delete operations
- Add comprehensive test coverage including size-based eviction
scenarios
- Update import paths across 14 files throughout the codebase
- Add defensive null checking for edge cases discovered during static
analysis
- Replace deprecated `keys()` iteration with modern `Symbol.iterator`
pattern
2025-08-15 14:31:00 +00:00
Sebastian "Sebbie" Silbermann 100881542a [test] Use NEXT_TEST_CI when forking test in CI (#79354) 2025-05-21 20:29:19 +02:00
Benjamin Woodruff 005db43079 chore(CI): Use TEST_CONCURRENCY by default in run-tests.js (#78731)
It seems too easy to accidentally not pass through `TEST_CONCURRENCY` in `build_and_test.yml`, so IMO `run-tests.js` should use it by default, still allowing overriding with `-c` or `--concurrency`.

I tested by spot-checking CI jobs for log lines like this:

```
Running tests with concurrency: 4 in test mode undefined
```

or

```
Running tests with concurrency: 1 in test mode undefined
```
2025-04-30 22:05:54 -07:00
Sebastian "Sebbie" Silbermann 1ee500b01e [test] Use React 19.1 everywhere (#77895) 2025-04-10 14:39:55 +02:00
Benjamin Woodruff 77874b8ebf refactor(CI): Assign tests to groups round-robin instead of sequentially when we don't have timings (#76462)
Our CI runs tests in parallel across multiple groups. We want test groups to all take similar amounts of time to decrease overall latency, and to reduce the chance of test group timeouts in CI.

There's logic here to assign intelligently to groups based on previous test timing information, but if there's no timing information for whatever reason (e.g. we don't currently use timings for rspack/turbopack integration tests), then we were assigning them to groups sequentially.

Because tests with similar paths tend to have similar performance characteristics, it's better to assign every nth test to each group, similar to round-robin assignment.
2025-02-25 16:45:20 -08:00
Jiwon Choi a89d55c011 [dev-overlay] Remove old Dev Overlay (#76256)
This PR removed the old overlay including the deprecated `buildActivity`
and `appIsrStatus` options.

Closes NDX-785
Closes NDX-855
Closes NDX-865
Closes NDX-866
Closes NDX-867
Closes NDX-868
2025-02-20 19:43:14 +09:00
Zack Tanner 1c85b755b5 [DevOverlay]: enable by default (#75882)
- `newDevOverlay: true` by default (enables experimental React builds on
canary until owner stacks progress further)
- `run-tests` now sets the env var for tests that were relying on it for
forking behavior
- PPR runners now run with the flag disabled to help catch regressions
in the old overlay until we remove it
- Fixed a number of tests that had outdated snapshots or missed forking
behavior because they weren't running in CI
- Disabled a test that was failing in Turbopack + Experimental React
that is unrelated to the overlay (see:
https://github.com/vercel/next.js/pull/75989)

---------

Co-authored-by: devjiwonchoi <devjiwonchoi@gmail.com>
2025-02-13 10:57:32 -08:00
Hendrik Liebau 763ca5e6a5 Increase test retries from 1 to 2 (#73795)
Let's see how this affects the failure rate and duration of our tests in
CI.

Test times for any given group might increase a bit, while hopefully at
least increasing the chance that the whole test group succeeds. This
would in theory reduce the number of times we have to re-run a whole
failed test group, which is quite time consuming.

A possible downside of this change is that flaky tests which have a
chance of getting fixed with a better implementation might be harder to
detect.
2024-12-11 18:57:55 +01:00
Sebastian "Sebbie" Silbermann 3c3fd7367e Use React 19 stable in Pages Router (#73562) 2024-12-05 21:19:20 +01:00
Vercel Release Bot 16c309358c Upgrade React from 1b1283ad-20241203 to de68d2f4-20241204 (#73525) 2024-12-04 21:16:56 +01:00
Vercel Release Bot c7a7ce7274 Upgrade React from b01722d5-20241114 to 1b1283ad-20241203 (#73506) 2024-12-04 16:50:44 +00:00
Jude Gao 05c101b9d8 Retire replay-io (#73282)
We had this wired up a long time ago but disabled it since it wasn't
helping much. So cleaning it up now.
2024-12-02 17:49:15 -05:00
Sebastian "Sebbie" Silbermann 28a25af1d6 Upgrade React from 380f5d67-20241113 to b01722d5-20241114 (#73107)
Co-authored-by: vercel-release-bot <infra+release@vercel.com>
2024-11-24 19:06:08 +01:00
Vercel Release Bot 6d39f220ca Upgrade React from 7ac8e612-20241113 to 380f5d67-20241113 (#72819) 2024-11-14 22:58:25 +01:00
Vercel Release Bot 35b47d5524 Upgrade React from 5c56b873-20241107 to 7ac8e612-20241113 (#72768) 2024-11-13 19:44:14 +01:00
Vercel Release Bot 18b357854b Upgrade React from 66855b96-20241106 to 5c56b873-20241107 (#72469) 2024-11-11 10:29:01 +00:00
Vercel Release Bot 8278fcc6f1 Upgrade React from 7c8e5e7a-20241101 to 66855b96-20241106 (#72415) 2024-11-06 17:12:33 +00:00
Vercel Release Bot c479c04e3e Upgrade React from 603e6108-20241029 to 7c8e5e7a-20241101 (#72199) 2024-11-03 19:11:20 +01:00
Vercel Release Bot e3c6b44b1a Upgrade React from 02c0e824-20241028 to 603e6108-20241029 (#72089) 2024-10-30 17:51:13 +01:00
Vercel Release Bot 8b65ec1b84 Upgrade React from 1631855f-20241023 to 02c0e824-20241028 (#71979) 2024-10-29 00:37:10 +01:00
Sebastian "Sebbie" Silbermann 655b808c5b Run with --enable-source-maps by default in next dev (#71820)
We already create server source maps in dev by default,
so we should make use of them.

To opt-out, run `next dev --disable-source-maps` instead.

Our internal `next-no-sourcemaps` script is now defunct.
2024-10-28 10:23:03 +01:00
Vercel Release Bot 4ae3fc3e35 Upgrade React from 28668d39-20241023 to 1631855f-20241023 (#71769)
**breaking change for canary users: Bumps peer dependency of React from
`19.0.0-rc-28668d39-20241023` to `19.0.0-rc-1631855f-20241023`**

[diff
facebook/react@28668d39...1631855f](https://github.com/facebook/react/compare/28668d39...1631855f)

<details>
<summary>React upstream changes</summary>

- https://github.com/facebook/react/pull/31340

</details>
2024-10-23 23:57:26 +00:00
Vercel Release Bot c464672dde Upgrade React from 45804af1-20241021 to 28668d39-20241023 (#71745) 2024-10-23 21:41:46 +02:00
Sebastian "Sebbie" Silbermann babc6a0242 Update React from 69d4b800-20241021 to 45804af1-20241021 (#71718) 2024-10-23 16:55:39 +00:00
Vercel Release Bot 8a905cf0cb Upgrade React from 65a56d0e-20241020 to 69d4b800-20241021 (#71568)
**breaking change for canary users: Bumps peer dependency of React from
`19.0.0-rc-65a56d0e-20241020` to `19.0.0-rc-69d4b800-20241021`**

[diff
facebook/react@65a56d0e...69d4b800](https://github.com/facebook/react/compare/65a56d0e...69d4b800)

<details>
<summary>React upstream changes</summary>

- https://github.com/facebook/react/pull/31313

</details>
2024-10-22 00:04:01 +02:00
Sebastian Markbåge 164723263b Update React (again) (#71528) 2024-10-20 03:31:42 -04:00
Sebastian Markbåge eb02b78afe Update React to bf7e210c (#71524) 2024-10-19 22:37:52 -07:00
Vercel Release Bot 3ff9b8b9d8 Upgrade React from 77b637d6-20241016 to bf7e210c-20241017 (#71436) 2024-10-18 10:23:31 +00:00
Vercel Release Bot cad01db9d2 Upgrade React from cd22717c-20241013 to 77b637d6-20241016 (#71391)
Co-authored-by: eps1lon <sebastian.silbermann@vercel.com>
2024-10-17 09:48:02 +00:00
Vercel Release Bot 69efa49c8e Upgrade React from 70fb1363-20241010 to cd22717c-20241013 (#71223) 2024-10-13 19:37:00 +00:00
Vercel Release Bot 2f7a48fa4d Upgrade React from 2d16326d-20240930 to 70fb1363-20241010 (#71118)
Co-authored-by: eps1lon <sebastian.silbermann@vercel.com>
2024-10-11 17:03:27 +00:00