Commit Graph
41 Commits
Author SHA1 Message Date
Sebastian "Sebbie" SilbermannandGitHub 7d98e0b534 [test] Include error code in Redbox snapshot (#90497) 2026-02-26 11:01:25 +00:00
Sebastian "Sebbie" SilbermannandGitHub dc8f77375d Stop adding additional padding to Next.js logs (#86139) 2025-11-17 19:10:24 -08:00
Sebastian "Sebbie" SilbermannandGitHub 014a254963 [test] Move all files to .ts (5/6) (#85640) 2025-11-05 11:41:04 +00:00
Sebastian "Sebbie" SilbermannandGitHub 0b58a32c45 [test] assert* -> waitFor* when the util is not instant (#85450) 2025-10-30 14:44:08 +01:00
Sebastian "Sebbie" SilbermannandGitHub 00261e9154 [test] Run all dev tests with sourcemaps enabled (#83173) 2025-08-29 10:18:11 +02:00
382b79bcc9 [sourcemaps] Consistent cursor columns (#81375)
Co-authored-by: Niklas Mischkulnig <[email protected]>
2025-07-16 20:45:34 +02:00
Benjamin WoodruffandGitHub 34c064e734 fix(test/integration): Check the right thing when resetting the server-side-dev-errors tests (#80873)
This was asserting that the error still exists after resetting the file back to its original state.

Instead, it should refresh the browser and check that the error was fixed.

Something was causing this to quickly reload in the rspack case, so the test was flaking there.

```
pnpm test-dev integration/server-side-dev-errors/test/index.test.js -t 'api route correctly'
pnpm test-dev-turbopack integration/server-side-dev-errors/test/index.test.js -t 'api route correctly'
pnpm test-dev-rspack integration/server-side-dev-errors/test/index.test.js -t 'api route correctly'
```

Try running the tests a few times, see that they don't flake.
2025-06-25 11:04:57 -07:00
JJ KasperandGitHub 256cd5b571 Add response handling inside handlers (#80189)
This continues the `handler` signature work from
https://github.com/vercel/next.js/pull/78166 and moves the
cache/response handling work inside of the pages, app pages, and app route handlers which allows them
to be fully invoked independent of `next-server`/`router-server`.

Validated against our deploy tests
https://github.com/vercel/vercel/actions/runs/15583209888/job/43883202911?pr=13433
and
https://github.com/vercel/next.js/actions/runs/15583265934/job/43883389321
2025-06-11 11:58:05 +00:00
Cong-Cong PanandGitHub 401bfe05f4 feat: using eval source map plugin for Rspack (#79199)
Use rspack.EvalSourceMapDevToolPlugin when running with Rspack

The modification specifically pass the test case in:
test/integration/server-side-dev-errors/test/index.test.js
2025-05-29 02:30:36 +00:00
JJ KasperandGitHub d937203f39 Implement initial handler interface for pages routes (#79260)
Continuation of https://github.com/vercel/next.js/pull/78166 this
implements the `handler` interface for pages routes, This does not move
the response handling inside of the handler yet as that will be in a
follow-up PR to keep the changes isolated. This still returns the
`RenderResult` for the `base-server` to continue to handle.

Validated against `vercel/vercel` deploy tests here
https://github.com/vercel/vercel/pull/13349
2025-05-20 16:23:50 -07:00
Sebastian "Sebbie" SilbermannandGitHub 8ea7d4bb35 [dev-overlay] Move error.name to label (#78198) 2025-04-25 11:00:58 +02:00
4e6c27befd Migrate pages API routes to handler interface (#78166)
This is one of the intial migrations for
https://github.com/vercel/next.js/discussions/77740 which starts by
adding the `handler` signature for pages API routes. This new `handler`
signature will be added for all route types and allows a consistent way
to invoke entries.

This also aims to align all logic to no longer be special cased between
minimal mode, standalone mode, and just normal `next start`. All modes
will behave and process requests the same at the entry level after this
is done.

Once all route types are migrated `next-server`, `web-server`, and
`base-server` will no longer be necessary and a minimal matching layer
will be provided to process rewrites/dynamic routes to the related entry
instead.

The changes here we validated against the `vercel/vercel` [test suite
here](https://github.com/vercel/vercel/pull/13231) and

---------

Co-authored-by: Sebastian Sebbie Silbermann <[email protected]>
2025-04-18 13:10:09 -07:00
Sebastian "Sebbie" SilbermannandGitHub a857856bba ignore-list published sources if they have a sourcemap (#78242) 2025-04-16 19:16:52 +02:00
Sebastian "Sebbie" SilbermannandGitHub b9d65b8afe [test] Assert on all errors in Redbox matchers (#77907) 2025-04-10 10:00:42 +02:00
Tim NeutkensandGitHub 6e51845ac4 Rename process.env.TURBOPACK to process.env.IS_TURBOPACK_TEST for tests (#77892)
Preparation for removing `process.env.TURBOPACK` being added to
Turbopack tests. That way we can properly test `next start` without
`process.env.TURBOPACK` being set.

<!-- 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

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### 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 #

-->
2025-04-07 14:07:55 +02:00
Tim NeutkensandGitHub 8040cf8728 Turbopack build: Fix urlencoding test (#77622)
### What?
- Added additional debug logging for `customRoutes`,
`publicFolderItems`, and `nextStaticFolderItems` in the filesystem
router utils
- Improved the dynamic route interpolation test to check all script
sources instead of just the first matching one
- Fixed the Turbopack build test manifest to correctly mark the dynamic
route interpolation test as passing
- Updated the `to_string()` implementation in `ServerFileSystem` to use
a hyphenated format so that it behaves the same between urlencoded and
urldecoded.

### Why?

This PR improves debugging capabilities for the filesystem router and
fixes the dynamic route interpolation test to be more robust by checking
all script sources rather than just the first one that matches certain
criteria. The test now properly verifies that both encoded and decoded
paths work correctly.

### How?
- Added debug statements for additional route-related variables
- Refactored the test to collect all script sources and verify each one
works with both encoded and decoded paths
- Updated the Turbopack test manifest to reflect the fixed test
- Changed the server filesystem string representation to use hyphens
instead of spaces
2025-03-31 10:40:14 +02:00
Will Binns-SmithandGitHub ed01269130 Update test snapshots for alternative bundler [6/n] (#76768)
Test Plan: `pnpm test-start-rspack
test/integration/server-side-dev-errors/test/index.test.js` passes
2025-03-06 09:11:08 -08:00
Sebastian "Sebbie" SilbermannandGitHub 5d53fd00fb [test] Use new Redbox matchers in pages/ service-side-dev-errors (#76779) 2025-03-04 10:24:38 +01:00
JJ KasperandGitHub 0be280dc79 Revert changing bundler for runtime bundle but keep externals fix (#75412)
This reverts the bundler change part while we investigate source map
issue but keeps the externals optimize preventing the runtime bundle
from inflating back to over `4MB`.

This reverts commit 98b0700e97
This reverts commit 04c3f0b29c
2025-01-29 16:50:31 +00:00
JJ KasperandGitHub 04c3f0b29c Update bundler for pre-bundling runtime (#75294)
This improves the build script quite a bit and makes dev editing much
faster. Also fixed excludes causing webpack/babel compiled packages to
be bundled into the runtime un-necessarily reducing from `10MB` ->
`1.2MB`.

Before: `Finished next_bundle in 9.67s`

After: `Finished next_bundle in 1.27s`

Validated here
https://github.com/vercel/vercel/actions/runs/12957911052/job/36147343396?pr=12914
2025-01-24 22:19:18 +00:00
Sebastian "Sebbie" SilbermannandGitHub 848c22977b Stop sourcemapping function names (#74085) 2024-12-19 20:54:35 +01:00
Tobias KoppersandGitHub 53bb90c073 [Turbopack] fix root and project path usages in a monorepo (#73552)
### What?

Improved trace source maps to return relative paths and always relative to process.cwd.

`turbopack://` urls in SourceMaps are always relative to the project root.

`file://` urls do no longer contain duplicate path segments.

Add a test case

Also:
* improve error when sourcemap lookup throws
2024-12-19 12:56:57 +01:00
Sebastian "Sebbie" SilbermannandGitHub 98de5db6d4 Use consistent error formatting in terminal (#71909) 2024-12-06 14:43:59 +01:00
Sebastian "Sebbie" SilbermannandGitHub 81f6cb4b80 Ensure Issue Overlay sourcemaps externals in Turbopack (#73439)
Closes https://linear.app/vercel/issue/NDX-473/
2024-12-04 10:11:19 +01:00
Jude GaoandGitHub 9ab8434df7 hmr-test waits for compile signal (#73064)
- The waitFor function now supports a predicate. Unlike retry, waitFor
does not include a timeout. Use it only when the predicate is guaranteed
to evaluate to true before proceeding to the next test. If it runs
indefinitely, Jest enforces a 120-second timeout per test.
- The getCliOutputFromHere utility provides a convenient string getter
that captures CLI output in between.
2024-11-21 15:29:24 -05:00
Sebastian "Sebbie" SilbermannandGitHub 776cd6828a Ensure Next.js is ignore-listed when used as external (#72498)
Observable in `pnpm next dev test/development/app-dir/dynamic-io-dev-errors/` and `/no-accessed-data`. It only affects the bottom stacks in that particular stack so assertions are not viable yet until the full stack is properly sourcemapped.
2024-11-13 14:20:22 +01:00
Jude GaoandGitHub d6dd69f210 (e2e) module-level patchFileDelay flag (#72439) 2024-11-12 06:29:03 -05:00
Sebastian "Sebbie" SilbermannandGitHub 719a187fcd Expand server-side-dev-errors assertions (/pages) (#72265)
Old assertions hid a lot of issues and didn't really tell us what changed.

`TODO(veil)` to make TODOs easier searchable
2024-11-07 16:48:35 +01:00
Wyatt JohnsonandGitHub 2f43ba59e5 [ppr] Resume Data Cache (#72161)
This adds a new ResumeDataCache concept to Next.js. This cache is persisted during production, and used for pre-seeding during development. Every route will generate its own resume data cache that will be used when partial prerendering is enabled. This lets us fill the caches during the prerender, and re-use those cache entries every time the page is resumed. This allows a future where we can reuse stale static shells while also reusing the resume data cache.
2024-11-04 17:59:48 -07:00
Wyatt JohnsonandGitHub e84b65b0d9 Expose allowHeader (#72033)
<!-- 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

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### 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 #

-->

Adds a new `allowHeader` to allow Next.js to specify which headers
should be included during revalidations that are used internally by
Next.js.
2024-10-29 14:54:26 -06:00
Sebastian SilbermannandGitHub fe8d953e2d Replace hasRedbox() (#67025)
...with `assertHasRedbox` and `assertNoRedbox`.

`hasRedbox()` has a hardcoded timeout of 5s that is only required for
the negative assertion.
Instead, we now have dedicated assertions for the positive
(`assertHasRedbox`) and negative case (`assertNoRedbox`).
The negative assertion still has the hardcoded timeout.
But the positive assertion just retries until we find the Redbox.

This speeds up tests using the positive assertion.
Removing `hasRedbox` also uncovered some unused expressions e.g. `await
hasRedbox(browser)`.
These expressions probably wanted to use `expect(await
hasRedbox(browser)).toBe(true)
2024-06-20 10:37:32 +02:00
b4db808822 OpenTelemetry: trace API routes in page router (#62120)
Co-authored-by: JJ Kasper <[email protected]>
2024-02-16 03:45:59 +00:00
Will Binns-SmithandGitHub 0060de1c49 Reapply "Turbopack: convert between locations correctly (#61477)" (#61733) (#61735)
This reverts commit a32d654c73.


Closes PACK-2421
2024-02-06 14:24:30 -08:00
Will Binns-SmithandGitHub a32d654c73 Revert "Turbopack: convert between locations correctly (#61477)" (#61733)
This reverts commit b19585f7fa.


Closes PACK-2420
2024-02-06 20:33:49 +01:00
b19585f7fa Turbopack: convert between locations correctly (#61477)
- parsed stack traces (and error stack locations in js) have 1-based
lines and 1-based columns
- source map tokens have 0-based lines and 0-based columns
- babel code frames use 1-based lines and 0-based columns

This was not always respected. This preserves the 1-based lines and
columns in anything called a stack frame, 0-based lines and columns for
source map apis, and converts to babel’s format as needed.


Closes PACK-2341

---------

Co-authored-by: Tobias Koppers <[email protected]>
2024-02-06 11:09:48 -08:00
Tim NeutkensandGitHub e169e73b45 Add hasRedbox fix (#60522)
## What?

As @leerob and I found in-person when opening #57230 the `hasRedBox()`
helper was incorrectly passing when it shouldn't pass in both the true
and false case.

This PR uses a different approach by waiting 7 seconds before checking,
this leaves enough room for HMR / reloads to apply, it doesn't
meaningfully slow down the test suite and increases reliability of the
check as you can see below in the tests that were previously passing
that are no longer passing.

I've moved these to skipped tests for landing this PR as I want to avoid
further issues being introduced while we fix them. @huozhi will
investigate these next week 👍

Failing tests that are temporarily skipped:
-
https://github.com/vercel/next.js/pull/60522/files#diff-513b477050bf1a620697b4d16bc1e6850282cb54e0609bdc5fd34307bfa9e471R9
-
https://github.com/vercel/next.js/pull/60522/files#diff-fa7d7c8c40914005c138d852eaf6a69ac0df51ec77bec548cbc5f0bfbdc8ebc5R25
-
https://github.com/vercel/next.js/pull/60522/files#diff-6f9f7dc131416cb17938311939a56d8c0e685a8fe6e8fc0cf5cd04939c74f388R41
-
https://github.com/vercel/next.js/pull/60522/files#diff-439830e340a320c56645e9d00aaf0fd0b492ddb90b6d7f9db89458ccc5158eb7R8
-
https://github.com/vercel/next.js/pull/60522/files#diff-62938bf5cd4d84f96dde8b6bcb2c8e18099e6dfca269c4302229b79175c0250cR18
-
https://github.com/vercel/next.js/pull/60522/files#diff-513b477050bf1a620697b4d16bc1e6850282cb54e0609bdc5fd34307bfa9e471R9


<!-- 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

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### 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 #

-->


Closes NEXT-2059
2024-01-15 09:36:44 +01:00
OJ KwonandGitHub 1145d27077 test(integration): adjust fixture to work with turbopack (#59595) 2023-12-13 13:17:52 -08:00
Hannes BornöandGitHub 2e135346cf Don't convert error to string (#36804)
Stack trace disappears when error is converted to string.
I changed the types in `log.ts` to match `console.log`/`console.error`/`console.warn`.

fixes #31591
2022-05-11 17:02:15 +00:00
db2567b01b chore: replace deprecated String.prototype.substr() (#35421)
.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated
Signed-off-by: Tobias Speicher <[email protected]>

Co-authored-by: Steven <[email protected]>
2022-03-24 17:49:38 -04:00
JJ KasperGitHubkodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
a92a5caec2 Update test set-up to leverage playwright when able to (#28634)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-09-13 14:36:25 +02:00
JJ KasperandGitHub f1dbc9260d Ensure dev server side errors are correct (#28520) 2021-08-27 14:29:30 +02:00