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.
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
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
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]>
### 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
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
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
### 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
- 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.
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.
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.
...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)
- 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]>
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
.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]>