Files
next.js/test/e2e/error-handler-not-found-req-url/error-handler-not-found-req-url.test.ts
ffd7f13c17 [Pages] fix: _error page's req.url can be overwritten to dynamic param on minimal mode (#82347)
In minimal mode, if there was `/[slug].js` with `notFound: true` on the
same segment of `_error.js`, `req.url` and `ctx.asPath` were returned as
`/[slug]`, since it was re-initialized to the request url.

Therefore, don't re-initialize the URL if it is in minimal mode && is
the `_error` page.

Fixes NEXT-4660

---------

Co-authored-by: JJ Kasper <[email protected]>
2025-08-05 20:06:32 +02:00

14 lines
409 B
TypeScript

import { nextTestSetup } from 'e2e-utils'
describe('error-handler-not-found-req-url', () => {
const { next } = nextTestSetup({
files: __dirname,
})
it('should log the correct request url and asPath for not found _error page', async () => {
const browser = await next.browser('/3')
const p = await browser.elementByCss('p')
expect(await p.text()).toBe('reqUrl: /3, asPath: /3')
})
})