b0b5cd8dc0
Currently if you find this error in your logs it's difficult to know where it occurred. This adds the page pathname to the error message. Before ![image](https://user-images.githubusercontent.com/25056922/221892504-383c0d31-5cc4-4e32-b317-9ebc42696151.png) After ![image](https://user-images.githubusercontent.com/25056922/221892431-1dd2c3e5-b6aa-46a2-8ca9-3be266fee76f.png) Ref: [slack](https://vercel.slack.com/archives/C03KAR5DCKC/p1677527238287849?thread_ts=1677521794.667229&cid=C03KAR5DCKC) ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
18 lines
596 B
TypeScript
18 lines
596 B
TypeScript
import { createNextDescribe } from 'e2e-utils'
|
|
import { check } from 'next-test-utils'
|
|
|
|
createNextDescribe(
|
|
'repeated-forward-slashes-error',
|
|
{
|
|
files: __dirname,
|
|
},
|
|
({ next }) => {
|
|
it('should log error when href has repeated forward-slashes', async () => {
|
|
await next.render$('/my/path/name')
|
|
await check(() => next.cliOutput, /Invalid href/)
|
|
expect(next.cliOutput).toContain(
|
|
"Invalid href '/hello//world' passed to next/router in page: '/my/path/[name]'. Repeated forward-slashes (//) or backslashes \\ are not valid in the href."
|
|
)
|
|
})
|
|
}
|
|
)
|