mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
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>
76 lines
3.1 KiB
TypeScript
76 lines
3.1 KiB
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
||
import {
|
||
waitForRedbox,
|
||
getRedboxDescription,
|
||
getRedboxSource,
|
||
} from 'next-test-utils'
|
||
|
||
describe('app-dir - server-component-next-dynamic-ssr-false', () => {
|
||
const { next } = nextTestSetup({
|
||
files: __dirname,
|
||
})
|
||
|
||
it('should error when use dynamic ssr:false in server component', async () => {
|
||
const browser = await next.browser('/')
|
||
await waitForRedbox(browser)
|
||
const redbox = {
|
||
description: await getRedboxDescription(browser),
|
||
source: await getRedboxSource(browser),
|
||
}
|
||
|
||
if (process.env.IS_TURBOPACK_TEST) {
|
||
expect(redbox.description).toMatchInlineSnapshot(
|
||
`"\`ssr: false\` is not allowed with \`next/dynamic\` in Server Components. Please move it into a Client Component."`
|
||
)
|
||
expect(redbox.source).toMatchInlineSnapshot(`
|
||
"./app/page.js (3:23)
|
||
Error: \`ssr: false\` is not allowed with \`next/dynamic\` in Server Components. Please move it into a Client Component.
|
||
1 | import dynamic from 'next/dynamic'
|
||
2 |
|
||
> 3 | const DynamicClient = dynamic(() => import('./client'), { ssr: false })
|
||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
4 |
|
||
5 | export default function Page() {
|
||
6 | return <DynamicClient />
|
||
|
||
Ecmascript file had an error"
|
||
`)
|
||
} else if (process.env.NEXT_RSPACK) {
|
||
expect(redbox.description).toMatchInlineSnapshot(
|
||
`" ╰─▶ × Error: x \`ssr: false\` is not allowed with \`next/dynamic\` in Server Components. Please move it into a Client Component."`
|
||
)
|
||
expect(redbox.source).toMatchInlineSnapshot(`
|
||
"./app/page.js
|
||
╰─▶ × Error: x \`ssr: false\` is not allowed with \`next/dynamic\` in Server Components. Please move it into a Client Component.
|
||
│ ,-[3:1]
|
||
│ 1 | import dynamic from 'next/dynamic'
|
||
│ 2 |
|
||
│ 3 | const DynamicClient = dynamic(() => import('./client'), { ssr: false })
|
||
│ : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
│ 4 |
|
||
│ 5 | export default function Page() {
|
||
│ 6 | return <DynamicClient />
|
||
│ \`----
|
||
│"
|
||
`)
|
||
} else {
|
||
expect(redbox.description).toMatchInlineSnapshot(
|
||
`" x \`ssr: false\` is not allowed with \`next/dynamic\` in Server Components. Please move it into a Client Component."`
|
||
)
|
||
expect(redbox.source).toMatchInlineSnapshot(`
|
||
"./app/page.js
|
||
Error: x \`ssr: false\` is not allowed with \`next/dynamic\` in Server Components. Please move it into a Client Component.
|
||
,-[3:1]
|
||
1 | import dynamic from 'next/dynamic'
|
||
2 |
|
||
3 | const DynamicClient = dynamic(() => import('./client'), { ssr: false })
|
||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
4 |
|
||
5 | export default function Page() {
|
||
6 | return <DynamicClient />
|
||
\`----"
|
||
`)
|
||
}
|
||
})
|
||
})
|