Files
next.js/test/e2e/app-dir/app-edge/app-edge-invalid-reexport.test.ts
Niklas MischkulnigandGitHub 9b8a7a1055 Turbopack: improve issue printing colors (#94858)
1. Align the code highlight marker color with the issue severity
2. Make the issue title colored
3. Prefix issues with `Warning` or `Error`


<img width="1383" height="862" alt="Bildschirmfoto 2026-06-16 um 18 59
03"
src="https://github.com/user-attachments/assets/f98c606d-4ea8-40c2-836d-e395f1df904c"
/>


<img width="1039" height="450" alt="Bildschirmfoto 2026-06-16 um 19 03
39"
src="https://github.com/user-attachments/assets/2747f914-0587-4178-a87d-344f24715c96"
/>



<details>
<summary>Old</summary>

<img width="1267" height="745" alt="Bildschirmfoto 2026-06-16 um 17 04
35"
src="https://github.com/user-attachments/assets/837739ff-82f7-4ea2-8767-ca7d866a8570"
/>

</details>
2026-06-16 21:29:37 +02:00

54 lines
1.8 KiB
TypeScript

import { FileRef, nextTestSetup } from 'e2e-utils'
import path from 'path'
describe('app-dir edge SSR invalid reexport', () => {
const { next, isNextDev, skipped } = nextTestSetup({
files: {
'app/export': new FileRef(path.join(__dirname, 'app', 'export')),
'app/export/inherit/page.tsx':
"export { default, runtime, preferredRegion } from '../basic/page'",
},
skipStart: true,
skipDeployment: true,
})
if (skipped) {
return
}
it('should warn or error about the re-export of a pages runtime/preferredRegion config', async () => {
try {
await next.start()
} catch (_) {
// We expect the build to fail
}
if (isNextDev) {
const browser = await next.browser('/export/inherit')
// Turbopack is stricter and disallows reexports completely
// webpack merely warns in the CLI and still serves the page wuthout a redbox
if (process.env.IS_TURBOPACK_TEST) {
await expect(browser).toDisplayRedbox(`
{
"description": "Next.js can't recognize the exported \`preferredRegion\` field in route. It mustn't be reexported.",
"environmentLabel": null,
"label": "Build Error",
"source": "./app/export/inherit/page.tsx (1:28)
Error: Next.js can't recognize the exported \`preferredRegion\` field in route. It mustn't be reexported.
> 1 | export { default, runtime, preferredRegion } from '../basic/page'
| ^^^^^^^^^^^^^^^",
"stack": [],
}
`)
}
}
expect(next.cliOutput).toInclude(
`Next.js can't recognize the exported \`runtime\` field in`
)
expect(next.cliOutput).toInclude(
`Next.js can't recognize the exported \`preferredRegion\` field in`
)
})
})