Files
next.js/test/e2e/app-dir/conflicting-page-segments/conflicting-page-segments.test.ts
7cbc15ab70 Turbopack Build: Fix conflicting page error (#79634)
## What?

Implements the missing part of the error to make the test pass.

Small difference between webpack/Turbopack is that Turbopack will spot
the conflict earlier and because of that errors earlier too, making the
path still correct but shorter, not a problem in my opinion.

---------

Co-authored-by: Niklas Mischkulnig <[email protected]>
2025-05-27 15:43:43 +02:00

36 lines
1.1 KiB
TypeScript

import { nextTestSetup } from 'e2e-utils'
import { retry } from 'next-test-utils'
describe('conflicting-page-segments', () => {
const { next, isNextDev, skipped } = nextTestSetup({
files: __dirname,
// we skip start & deploy because the build will fail and we won't be able to catch it
// start is re-triggered but caught in the assertions below.
skipStart: true,
skipDeployment: true,
})
if (skipped) {
return
}
it('should throw an error when a route groups causes a conflict with a parallel segment', async () => {
if (isNextDev) {
await next.start()
const html = await next.render('/')
expect(html).toContain(
'You cannot have two parallel pages that resolve to the same path.'
)
} else {
await expect(next.start()).rejects.toThrow('next build failed')
await retry(() => {
expect(next.cliOutput).toMatch(
/You cannot have two parallel pages that resolve to the same path\. Please check \/\(group-a\)(\/page)? and \/\(group-b\)(\/page)?\./i
)
})
}
})
})