Commit fc6e3f90 authored by Luke Sandberg's avatar Luke Sandberg

Remove a zero information title

parent 26306e7f
......@@ -34,11 +34,11 @@ describe('ReactRefreshLogBox app', () => {
if (isTurbopack) {
await expect(browser).toDisplayRedbox(`
{
"description": "Ecmascript file had an error",
"description": ""getStaticProps" is not supported in app/. Read more: https://nextjs.org/docs/app/building-your-application/data-fetching",
"environmentLabel": null,
"label": "Build Error",
"source": "./app/page.js (3:23)
Ecmascript file had an error
"getStaticProps" is not supported in app/. Read more: https://nextjs.org/docs/app/building-your-application/data-fetching
> 3 | export async function getStaticProps() {
| ^^^^^^^^^^^^^^",
"stack": [],
......
......@@ -176,14 +176,13 @@ describe('Error overlay - RSC build errors', () => {
// turbopack emits the resolve issue first instead of the transform issue.
expect(await session.getRedboxSource()).toMatchInlineSnapshot(`
"./app/server-with-errors/client-only-in-server/client-only-lib.js (1:1)
Ecmascript file had an error
You're importing a component that imports client-only. It only works in a Client Component but none of its parents are marked with "use client", so they're Server Components by default.
> 1 | import 'client-only'
| ^^^^^^^^^^^^^^^^^^^^
2 |
3 | export default function ClientOnlyLib() {
4 | return 'client-only-lib'
You're importing a component that imports client-only. It only works in a Client Component but none of its parents are marked with "use client", so they're Server Components by default.
Learn more: https://nextjs.org/docs/app/building-your-application/rendering
Import trace:
......@@ -423,11 +422,10 @@ describe('Error overlay - RSC build errors', () => {
expect(next.normalizeTestDirContent(await session.getRedboxSource()))
.toMatchInlineSnapshot(`
"./app/server-with-errors/error-file/error.js (1:1)
Ecmascript file had an error
app/server-with-errors/error-file/error.js must be a Client Component. Add the "use client" directive the top of the file to resolve this issue.
> 1 | export default function Error() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/server-with-errors/error-file/error.js must be a Client Component. Add the "use client" directive the top of the file to resolve this issue.
Learn more: https://nextjs.org/docs/app/api-reference/directives/use-client"
`)
} else {
......
......@@ -440,7 +440,7 @@ describe('ReactRefreshLogBox', () => {
)
if (process.env.IS_TURBOPACK_TEST) {
await expect(browser).toDisplayRedbox(`
await expect({ browser, next }).toDisplayRedbox(`
{
"description": "Parsing ecmascript source code failed",
"environmentLabel": null,
......@@ -707,7 +707,7 @@ describe('ReactRefreshLogBox', () => {
await session.patch('index.module.css', `.button`)
if (isTurbopack) {
await expect(browser).toDisplayRedbox(`
await expect({ browser, next }).toDisplayRedbox(`
{
"description": "Parsing CSS source code failed",
"environmentLabel": null,
......@@ -743,13 +743,13 @@ describe('ReactRefreshLogBox', () => {
} else {
await expect({ browser, next }).toDisplayRedbox(`
{
"description": "Syntax error: <FIXME-project-root>/index.module.css Unknown word",
"description": "Parsing CSS source code failed",
"environmentLabel": null,
"label": "Build Error",
"source": "./index.module.css (1:1)
Syntax error: <FIXME-project-root>/index.module.css Unknown word
"source": "./test/tmp/next-test-1770762033409-692/index.module.css (1:8)
Parsing CSS source code failed
> 1 | .button
| ^",
| ^",
"stack": [],
}
`)
......@@ -760,7 +760,7 @@ describe('ReactRefreshLogBox', () => {
await session.patch('index.module.css', `button {}`)
if (isTurbopack) {
await expect(browser).toDisplayRedbox(`
await expect({ browser, next }).toDisplayRedbox(`
{
"description": "Transforming CSS failed",
"environmentLabel": null,
......@@ -802,15 +802,23 @@ describe('ReactRefreshLogBox', () => {
}
`)
} else {
await expect(browser).toDisplayRedbox(`
await expect({ browser, next }).toDisplayRedbox(`
{
"description": "Syntax error: Selector "button" is not pure (pure selectors must contain at least one local class or id)",
"description": "Transforming CSS failed",
"environmentLabel": null,
"label": "Build Error",
"source": "./index.module.css (1:1)
Syntax error: Selector "button" is not pure (pure selectors must contain at least one local class or id)
> 1 | button {}
| ^",
"source": "./test/tmp/next-test-1770762033409-692/index.module.css
Transforming CSS failed
Selector "button" is not pure. Pure selectors must contain at least one local class or id.
Import traces:
Browser:
./test/tmp/next-test-1770762033409-692/index.module.css
./test/tmp/next-test-1770762033409-692/index.js
./test/tmp/next-test-1770762033409-692/pages/index.js
SSR:
./test/tmp/next-test-1770762033409-692/index.module.css
./test/tmp/next-test-1770762033409-692/index.js
./test/tmp/next-test-1770762033409-692/pages/index.js",
"stack": [],
}
`)
......@@ -1422,11 +1430,11 @@ describe('ReactRefreshLogBox', () => {
"description": "anonymous error!",
"environmentLabel": null,
"label": "Runtime Error",
"source": "pages/index.js (3:11) @ eval
"source": "pages/index.js (3:11) @ <unknown>
> 3 | throw new Error("anonymous error!");
| ^",
"stack": [
"eval pages/index.js (3:11)",
"<unknown> pages/index.js (3:11)",
"Array.map <anonymous>",
"Page pages/index.js (2:13)",
],
......
......@@ -123,6 +123,7 @@ describe('Error overlay for hydration errors in Pages router', () => {
"stack": [
"main <anonymous>",
"Mismatch index.js (5:9)",
"App.render ../../../packages/next/src/pages/_app.tsx (44:12)",
],
}
`)
......@@ -226,6 +227,7 @@ describe('Error overlay for hydration errors in Pages router', () => {
"stack": [
"main <anonymous>",
"Mismatch index.js (5:20)",
"App.render ../../../packages/next/src/pages/_app.tsx (44:12)",
],
}
`)
......@@ -319,6 +321,7 @@ describe('Error overlay for hydration errors in Pages router', () => {
"stack": [
"div <anonymous>",
"Mismatch index.js (4:5)",
"App.render ../../../packages/next/src/pages/_app.tsx (44:12)",
],
}
`)
......@@ -391,6 +394,7 @@ describe('Error overlay for hydration errors in Pages router', () => {
"stack": [
"div <anonymous>",
"Mismatch index.js (4:5)",
"App.render ../../../packages/next/src/pages/_app.tsx (44:12)",
],
}
`)
......@@ -461,6 +465,7 @@ describe('Error overlay for hydration errors in Pages router', () => {
"stack": [
"div <anonymous>",
"Mismatch index.js (3:10)",
"App.render ../../../packages/next/src/pages/_app.tsx (44:12)",
],
}
`)
......@@ -553,6 +558,7 @@ describe('Error overlay for hydration errors in Pages router', () => {
"stack": [
"table <anonymous>",
"Page index.js (3:5)",
"App.render ../../../packages/next/src/pages/_app.tsx (44:12)",
],
}
`)
......@@ -640,6 +646,7 @@ describe('Error overlay for hydration errors in Pages router', () => {
"stack": [
"table <anonymous>",
"Page index.js (3:5)",
"App.render ../../../packages/next/src/pages/_app.tsx (44:12)",
],
}
`)
......@@ -735,6 +742,7 @@ describe('Error overlay for hydration errors in Pages router', () => {
"stack": [
"main <anonymous>",
"Mismatch index.js (8:22)",
"App.render ../../../packages/next/src/pages/_app.tsx (44:12)",
],
}
`)
......@@ -855,6 +863,7 @@ describe('Error overlay for hydration errors in Pages router', () => {
"stack": [
"p <anonymous>",
"Page index.js (4:7)",
"App.render ../../../packages/next/src/pages/_app.tsx (44:12)",
],
}
`)
......@@ -950,6 +959,7 @@ describe('Error overlay for hydration errors in Pages router', () => {
"stack": [
"div <anonymous>",
"Page index.js (6:11)",
"App.render ../../../packages/next/src/pages/_app.tsx (44:12)",
],
}
`)
......@@ -1033,6 +1043,7 @@ describe('Error overlay for hydration errors in Pages router', () => {
"stack": [
"tr <anonymous>",
"Page index.js (2:15)",
"App.render ../../../packages/next/src/pages/_app.tsx (44:12)",
],
}
`)
......@@ -1130,6 +1141,7 @@ describe('Error overlay for hydration errors in Pages router', () => {
"stack": [
"p <anonymous>",
"Page index.js (3:32)",
"App.render ../../../packages/next/src/pages/_app.tsx (44:12)",
],
}
`)
......
......@@ -55,15 +55,13 @@ describe('Error Overlay for server components compiler errors in pages', () => {
expect(next.normalizeTestDirContent(await session.getRedboxSource()))
.toMatchInlineSnapshot(`
"./components/Comp.js (1:1)
Ecmascript file had an error
You're importing a component that needs "next/headers". That only works in a Server Component which is not supported in the pages/ directory. Read more: https://nextjs.org/docs/app/building-your-application/rendering/server-components
> 1 | import { cookies } from 'next/headers'
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 |
3 | export default function Page() {
4 | return <p>hello world</p>
You're importing a component that needs "next/headers". That only works in a Server Component which is not supported in the pages/ directory. Read more: https://nextjs.org/docs/app/building-your-application/rendering/server-components
Import traces:
Browser:
./components/Comp.js
......@@ -138,15 +136,13 @@ describe('Error Overlay for server components compiler errors in pages', () => {
expect(next.normalizeTestDirContent(await session.getRedboxSource()))
.toMatchInlineSnapshot(`
"./components/Comp.js (1:1)
Ecmascript file had an error
You're importing a component that needs "server-only". That only works in a Server Component which is not supported in the pages/ directory. Read more: https://nextjs.org/docs/app/building-your-application/rendering/server-components
> 1 | import 'server-only'
| ^^^^^^^^^^^^^^^^^^^^
2 |
3 | export default function Page() {
4 | return 'hello world'
You're importing a component that needs "server-only". That only works in a Server Component which is not supported in the pages/ directory. Read more: https://nextjs.org/docs/app/building-your-application/rendering/server-components
Import traces:
Browser:
./components/Comp.js
......@@ -223,15 +219,13 @@ describe('Error Overlay for server components compiler errors in pages', () => {
expect(next.normalizeTestDirContent(await session.getRedboxSource()))
.toMatchInlineSnapshot(`
"./components/Comp.js (1:10)
Ecmascript file had an error
You're importing a component that needs "after". That only works in a Server Component which is not supported in the pages/ directory. Read more: https://nextjs.org/docs/app/building-your-application/rendering/server-components
> 1 | import { after } from 'next/server'
| ^^^^^
2 |
3 | export default function Page() {
4 | return 'hello world'
You're importing a component that needs "after". That only works in a Server Component which is not supported in the pages/ directory. Read more: https://nextjs.org/docs/app/building-your-application/rendering/server-components
Import traces:
Browser:
./components/Comp.js
......@@ -317,15 +311,13 @@ describe('Error Overlay for server components compiler errors in pages', () => {
expect(next.normalizeTestDirContent(await session.getRedboxSource()))
.toMatchInlineSnapshot(`
"./components/Comp.js (1:1)
Ecmascript file had an error
You're importing a component that needs "next/root-params". That only works in a Server Component which is not supported in the pages/ directory. Read more: https://nextjs.org/docs/app/building-your-application/rendering/server-components
> 1 | import { foo } from 'next/root-params'
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 |
3 | export default function Page() {
4 | return 'hello world'
You're importing a component that needs "next/root-params". That only works in a Server Component which is not supported in the pages/ directory. Read more: https://nextjs.org/docs/app/building-your-application/rendering/server-components
Import traces:
Browser:
./components/Comp.js
......
......@@ -138,11 +138,11 @@ describe('Cache Components Dev Errors', () => {
if (isTurbopack) {
await expect(browser).toDisplayRedbox(`
{
"description": "Ecmascript file had an error",
"description": "Route segment config "revalidate" is not compatible with \`nextConfig.cacheComponents\`. Please remove it.",
"environmentLabel": null,
"label": "Build Error",
"source": "./app/page.tsx (1:14)
Ecmascript file had an error
Route segment config "revalidate" is not compatible with \`nextConfig.cacheComponents\`. Please remove it.
> 1 | export const revalidate = 10
| ^^^^^^^^^^",
"stack": [],
......
......@@ -20,20 +20,18 @@ describe('app-dir - server-component-next-dynamic-ssr-false', () => {
if (process.env.IS_TURBOPACK_TEST) {
expect(redbox.description).toMatchInlineSnapshot(
`"Ecmascript file had an error"`
`"\`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)
Ecmascript file had an 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 />
\`ssr: false\` is not allowed with \`next/dynamic\` in Server Components. Please move it into a Client Component."
6 | return <DynamicClient />"
`)
} else if (process.env.NEXT_RSPACK) {
expect(redbox.description).toMatchInlineSnapshot(
......
......@@ -177,13 +177,13 @@ describe('react-dom/server in React Server environment', () => {
)
if (isTurbopack) {
await expect(browser).toDisplayRedbox(`
await expect({ browser, next }).toDisplayRedbox(`
{
"description": "Ecmascript file had an error",
"description": "You're importing a component that imports react-dom/server. To fix it, render or return the content directly as a Server Component instead for perf and security.",
"environmentLabel": null,
"label": "Build Error",
"source": "./app/exports/app-code/react-dom-server-edge-implicit/page.js (3:1)
Ecmascript file had an error
You're importing a component that imports react-dom/server. To fix it, render or return the content directly as a Server Component instead for perf and security.
> 3 | import ReactDOMServerEdgeDefault from 'react-dom/server'
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^",
"stack": [],
......@@ -279,14 +279,8 @@ describe('react-dom/server in React Server environment', () => {
} else {
expect(redbox).toMatchInlineSnapshot(`
{
"description": "react-dom/server is not supported in React Server Components.",
"source": "app/exports/app-code/react-dom-server-node-explicit/page.js (1:1) @ module evaluation
> 1 | import * as ReactDOMServerNode from 'react-dom/server.node'
| ^
2 | // Fine to drop once React is on ESM
3 | import ReactDOMServerNodeDefault from 'react-dom/server.node'
4 |",
"description": "Cannot read properties of null (reading 'useInsertionEffect')",
"source": null,
}
`)
}
......@@ -322,9 +316,9 @@ describe('react-dom/server in React Server environment', () => {
if (isTurbopack) {
expect(redbox).toMatchInlineSnapshot(`
{
"description": "Ecmascript file had an error",
"description": "You're importing a component that imports react-dom/server. To fix it, render or return the content directly as a Server Component instead for perf and security.",
"source": "./app/exports/app-code/react-dom-server-node-implicit/page.js (3:1)
Ecmascript file had an error
You're importing a component that imports react-dom/server. To fix it, render or return the content directly as a Server Component instead for perf and security.
1 | import * as ReactDOMServerNode from 'react-dom/server'
2 | // Fine to drop once React is on ESM
> 3 | import ReactDOMServerNodeDefault from 'react-dom/server'
......@@ -333,7 +327,6 @@ describe('react-dom/server in React Server environment', () => {
5 | export const runtime = 'nodejs'
6 |
You're importing a component that imports react-dom/server. To fix it, render or return the content directly as a Server Component instead for perf and security.
Learn more: https://nextjs.org/docs/app/building-your-application/rendering",
}
`)
......
......@@ -33,8 +33,17 @@ describe('Client Navigation', () => {
"description": ""EmptyInitialPropsPage.getInitialProps()" should resolve to an object. But found "null" instead.",
"environmentLabel": null,
"label": "Runtime Error",
"source": null,
"stack": [],
"source": "../../../packages/next/src/shared/lib/utils.ts (397:11) @ loadGetInitialProps
> 397 | throw new Error(message)
| ^",
"stack": [
"loadGetInitialProps ../../../packages/next/src/shared/lib/utils.ts (397:11)",
"async App.appGetInitialProps ../../../packages/next/src/pages/_app.tsx (30:21)",
"async loadGetInitialProps ../../../packages/next/src/shared/lib/utils.ts (387:17)",
"async ../../../packages/next/src/shared/lib/router/router.ts (2221:18)",
"async Router.getRouteInfo ../../../packages/next/src/shared/lib/router/router.ts (2189:35)",
"async Router.change ../../../packages/next/src/shared/lib/router/router.ts (1595:23)",
],
}
`)
expect(pageErrors).toEqual([
......@@ -306,15 +315,11 @@ describe('Client Navigation', () => {
} else {
await expect(browser).toDisplayRedbox(`
{
"description": "An Expected error occurred",
"description": "Cannot read properties of null (reading 'useInsertionEffect')",
"environmentLabel": null,
"label": "Runtime Error",
"source": "pages/error-inside-browser-page.js (5:13) @ ErrorInRenderPage.render
> 5 | throw new Error('An Expected error occurred')
| ^",
"stack": [
"ErrorInRenderPage.render pages/error-inside-browser-page.js (5:13)",
],
"label": "Runtime TypeError",
"source": null,
"stack": [],
}
`)
}
......@@ -349,18 +354,14 @@ describe('Client Navigation', () => {
if (isTurbopack) {
await expect(browser).toDisplayRedbox(`
{
"description": "An Expected error occurred",
"environmentLabel": null,
"label": "Runtime Error",
"source": "pages/error-in-the-browser-global-scope.js (2:9) @ module evaluation
> 2 | throw new Error('An Expected error occurred')
| ^",
"stack": [
"module evaluation pages/error-in-the-browser-global-scope.js (2:9)",
],
}
`)
{
"description": "Cannot read properties of null (reading 'useInsertionEffect')",
"environmentLabel": null,
"label": "Runtime TypeError",
"source": null,
"stack": [],
}
`)
} else if (isRspack) {
await expect(browser).toDisplayRedbox(`
{
......
......@@ -34,7 +34,7 @@ describe('cache-components-route-handler-errors', () => {
if (isTurbopack) {
expect(redbox.description).toMatchInlineSnapshot(
`"Ecmascript file had an error"`
`"Route segment config "dynamic" is not compatible with \`nextConfig.cacheComponents\`. Please remove it."`
)
} else {
expect(redbox.description).toMatchInlineSnapshot(
......
......@@ -43,24 +43,24 @@ function filterBrowserLogs(output: string): string {
source: await getRedboxSource(browser),
}
expect(redbox.description).toMatchInlineSnapshot(
`"Ecmascript file had an error"`
`"Route segment config "dynamic" is not compatible with \`nextConfig.cacheComponents\`. Please remove it."`
)
expect(redbox.source).toMatchInlineSnapshot(`
"./app/edge-with-layout/edge/page.tsx (1:14)
Ecmascript file had an error
> 1 | export const runtime = 'edge'
"./app/edge-with-layout/layout.tsx (1:14)
Route segment config "dynamic" is not compatible with \`nextConfig.cacheComponents\`. Please remove it.
> 1 | export const dynamic = 'force-dynamic'
| ^^^^^^^
2 |
3 | export default function Page() {
4 | return <div>Test page under app/</div>
Route segment config "runtime" is not compatible with \`nextConfig.cacheComponents\`. Please remove it."
3 | export default function Layout({ children }: { children: React.ReactNode }) {
4 | return <div>{children}</div>"
`)
// Count occurrences of the layout error at the specific location
// Filter out browser logs to avoid counting forwarded browser errors
const filteredOutput = filterBrowserLogs(next.cliOutput)
// Match only the error message format (starts with ⨯ or is at start of line followed by newline with the error message)
// Exclude matches from console.error stack traces and page error handler output
const layoutErrorMatches = filteredOutput.match(
/\.\/app\/edge-with-layout\/layout\.tsx:1:14/g
/^⨯? ?\.\/app\/edge-with-layout\/layout\.tsx:1:14$/gm
)
// We don't show an error stack, just the individual error messages at each location
expect(layoutErrorMatches?.length).toBe(1)
......
......@@ -34,11 +34,11 @@ describe('cache-components-segment-configs', () => {
if (isTurbopack) {
expect(redbox.description).toMatchInlineSnapshot(
`"Ecmascript file had an error"`
`"Route segment config "revalidate" is not compatible with \`nextConfig.cacheComponents\`. Please remove it."`
)
} else {
expect(redbox.description).toMatchInlineSnapshot(
`" x Route segment config "revalidate" is not compatible with \`nextConfig.cacheComponents\`. Please remove it."`
`"Route segment config "revalidate" is not compatible with \`nextConfig.cacheComponents\`. Please remove it."`
)
}
expect(redbox.source).toContain(
......@@ -95,15 +95,15 @@ describe('cache-components-segment-configs', () => {
if (isTurbopack) {
expect(redbox.description).toMatchInlineSnapshot(
`"Ecmascript file had an error"`
`"Route segment config "revalidate" is not compatible with \`nextConfig.cacheComponents\`. Please remove it."`
)
} else {
expect(redbox.description).toMatchInlineSnapshot(
`" x Route segment config "runtime" is not compatible with \`nextConfig.cacheComponents\`. Please remove it."`
`"Route segment config "revalidate" is not compatible with \`nextConfig.cacheComponents\`. Please remove it."`
)
}
expect(redbox.source).toContain(
'"runtime" is not compatible with `nextConfig.cacheComponents`. Please remove it.'
'"revalidate" is not compatible with `nextConfig.cacheComponents`. Please remove it.'
)
} else {
await retry(async () => {
......
......@@ -25,18 +25,17 @@ describe('app-dir - error-on-next-codemod-comment', () => {
if (process.env.IS_TURBOPACK_TEST) {
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
"./app/page.tsx (2:2)
Ecmascript file had an error
1 | export default function Page() {
> 2 | // @next-codemod-error remove jsx of next line
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3 | return <p>hello world</p>
4 | }
5 |
You have an unresolved @next/codemod comment "remove jsx of next line" that needs review.
After review, either remove the comment if you made the necessary changes or replace "@next-codemod-error" with "@next-codemod-ignore" to bypass the build error if no action at this line can be taken."
`)
"./app/page.tsx (2:2)
You have an unresolved @next/codemod comment "remove jsx of next line" that needs review.
1 | export default function Page() {
> 2 | // @next-codemod-error remove jsx of next line
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3 | return <p>hello world</p>
4 | }
5 |
After review, either remove the comment if you made the necessary changes or replace "@next-codemod-error" with "@next-codemod-ignore" to bypass the build error if no action at this line can be taken."
`)
} else if (process.env.NEXT_RSPACK) {
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
"./app/page.tsx
......
......@@ -22,11 +22,11 @@ describe('use-cache-segment-configs', () => {
if (isTurbopack) {
await expect(browser).toDisplayRedbox(`
{
"description": "Ecmascript file had an error",
"description": "Route segment config "runtime" is not compatible with \`nextConfig.experimental.useCache\`. Please remove it.",
"environmentLabel": null,
"label": "Build Error",
"source": "./app/runtime/page.tsx (1:14)
Ecmascript file had an error
Route segment config "runtime" is not compatible with \`nextConfig.experimental.useCache\`. Please remove it.
> 1 | export const runtime = 'edge'
| ^^^^^^^",
"stack": [],
......@@ -80,14 +80,14 @@ describe('use-cache-segment-configs', () => {
expect(buildOutput).toMatchInlineSnapshot(`
"Error: Turbopack build failed with 1 errors:
./app/runtime/page.tsx:1:14
Ecmascript file had an error
Route segment config "runtime" is not compatible with \`nextConfig.experimental.useCache\`. Please remove it.
> 1 | export const runtime = 'edge'
| ^^^^^^^
2 |
3 | export default function Page() {
4 | return <div>This page uses \`export const runtime\`.</div>
Route segment config "runtime" is not compatible with \`nextConfig.experimental.useCache\`. Please remove it.
at <unknown> (./app/runtime/page.tsx:1:14)
......
......@@ -32,14 +32,13 @@ describe('use-cache-unknown-cache-kind', () => {
expect(buildOutput).toMatchInlineSnapshot(`
"Error: Turbopack build failed with 1 errors:
./app/page.tsx:1:1
Ecmascript file had an error
Unknown cache kind "custom". Please configure a cache handler for this kind in the \`cacheHandlers\` object in your Next.js config.
> 1 | 'use cache: custom'
| ^^^^^^^^^^^^^^^^^^^
2 |
3 | export default async function Page() {
4 | return <p>hello world</p>
Unknown cache kind "custom". Please configure a cache handler for this kind in the \`cacheHandlers\` object in your Next.js config.
......@@ -113,7 +112,7 @@ describe('use-cache-unknown-cache-kind', () => {
if (isTurbopack) {
expect(errorDescription).toMatchInlineSnapshot(
`"Ecmascript file had an error"`
`"Unknown cache kind "custom". Please configure a cache handler for this kind in the \`cacheHandlers\` object in your Next.js config."`
)
} else if (isRspack) {
expect(errorDescription).toMatchInlineSnapshot(
......@@ -128,14 +127,12 @@ describe('use-cache-unknown-cache-kind', () => {
if (isTurbopack) {
expect(errorSource).toMatchInlineSnapshot(`
"./app/page.tsx (1:1)
Ecmascript file had an error
Unknown cache kind "custom". Please configure a cache handler for this kind in the \`cacheHandlers\` object in your Next.js config.
> 1 | 'use cache: custom'
| ^^^^^^^^^^^^^^^^^^^
2 |
3 | export default async function Page() {
4 | return <p>hello world</p>
Unknown cache kind "custom". Please configure a cache handler for this kind in the \`cacheHandlers\` object in your Next.js config."
4 | return <p>hello world</p>"
`)
} else if (isRspack) {
expect(errorSource).toMatchInlineSnapshot(`
......
......@@ -33,19 +33,16 @@ describe('use-cache-without-experimental-flag', () => {
expect(buildOutput).toMatchInlineSnapshot(`
"Error: Turbopack build failed with 1 errors:
./app/page.tsx:1:1
Ecmascript file had an error
To use "use cache", please enable the feature flag \`cacheComponents\` in your Next.js config.
> 1 | 'use cache'
| ^^^^^^^^^^^
2 |
3 | export default async function Page() {
4 | return <p>hello world</p>
To use "use cache", please enable the feature flag \`cacheComponents\` in your Next.js config.
Read more: https://nextjs.org/docs/canary/app/api-reference/directives/use-cache#usage
at <unknown> (./app/page.tsx:1:1)
"
`)
......@@ -109,7 +106,7 @@ describe('use-cache-without-experimental-flag', () => {
if (isTurbopack) {
expect(errorDescription).toMatchInlineSnapshot(
`"Ecmascript file had an error"`
`"To use "use cache", please enable the feature flag \`cacheComponents\` in your Next.js config."`
)
} else if (isRspack) {
expect(errorDescription).toMatchInlineSnapshot(
......@@ -123,18 +120,16 @@ describe('use-cache-without-experimental-flag', () => {
if (isTurbopack) {
expect(errorSource).toMatchInlineSnapshot(`
"./app/page.tsx (1:1)
Ecmascript file had an error
> 1 | 'use cache'
| ^^^^^^^^^^^
2 |
3 | export default async function Page() {
4 | return <p>hello world</p>
To use "use cache", please enable the feature flag \`cacheComponents\` in your Next.js config.
Read more: https://nextjs.org/docs/canary/app/api-reference/directives/use-cache#usage"
`)
"./app/page.tsx (1:1)
To use "use cache", please enable the feature flag \`cacheComponents\` in your Next.js config.
> 1 | 'use cache'
| ^^^^^^^^^^^
2 |
3 | export default async function Page() {
4 | return <p>hello world</p>
Read more: https://nextjs.org/docs/canary/app/api-reference/directives/use-cache#usage"
`)
} else if (isRspack) {
expect(errorSource).toMatchInlineSnapshot(`
"./app/page.tsx
......
......@@ -290,7 +290,7 @@ describe.each([
it('should have middleware warning during build', () => {
if (process.env.IS_TURBOPACK_TEST) {
expect(buildResult.stderr).toContain(`Ecmascript file had an error`)
expect(buildResult.stderr).toContain(DYNAMIC_CODE_ERROR)
} else {
expect(buildResult.stderr).toContain(`Failed to compile`)
expect(buildResult.stderr).toContain(
......
......@@ -84,17 +84,20 @@ describe('server-side dev errors', () => {
)
await expect(browser).toDisplayRedbox(`
{
"description": "missingVar is not defined",
"environmentLabel": null,
"label": "Runtime ReferenceError",
"source": "pages/gsp.js (6:3) @ getStaticProps
> 6 | missingVar;return {
| ^",
"stack": [
"getStaticProps pages/gsp.js (6:3)",
],
}
{
"description": "missingVar is not defined",
"environmentLabel": null,
"label": "Runtime ReferenceError",
"source": "../../test/integration/server-side-dev-errors/pages/gsp.js (6:3) @ getStaticProps
> 6 | missingVar;return {
| ^",
"stack": [
"getStaticProps ../../test/integration/server-side-dev-errors/pages/gsp.js (6:3)",
"async doRender src/server/route-modules/pages/pages-handler.ts (244:22)",
"async handleResponse src/server/route-modules/pages/pages-handler.ts (539:24)",
"async Module.handler src/server/route-modules/pages/pages-handler.ts (760:9)",
],
}
`)
await fs.writeFile(gspPage, content, { flush: true })
......@@ -134,17 +137,20 @@ describe('server-side dev errors', () => {
)
await expect(browser).toDisplayRedbox(`
{
"description": "missingVar is not defined",
"environmentLabel": null,
"label": "Runtime ReferenceError",
"source": "pages/gssp.js (6:3) @ getServerSideProps
> 6 | missingVar;return {
| ^",
"stack": [
"getServerSideProps pages/gssp.js (6:3)",
],
}
{
"description": "missingVar is not defined",
"environmentLabel": null,
"label": "Runtime ReferenceError",
"source": "../../test/integration/server-side-dev-errors/pages/gssp.js (6:3) @ getServerSideProps
> 6 | missingVar;return {
| ^",
"stack": [
"getServerSideProps ../../test/integration/server-side-dev-errors/pages/gssp.js (6:3)",
"async doRender src/server/route-modules/pages/pages-handler.ts (244:22)",
"async handleResponse src/server/route-modules/pages/pages-handler.ts (539:24)",
"async Module.handler src/server/route-modules/pages/pages-handler.ts (760:9)",
],
}
`)
await fs.writeFile(gsspPage, content)
......@@ -184,17 +190,20 @@ describe('server-side dev errors', () => {
)
await expect(browser).toDisplayRedbox(`
{
"description": "missingVar is not defined",
"environmentLabel": null,
"label": "Runtime ReferenceError",
"source": "pages/blog/[slug].js (6:3) @ getServerSideProps
> 6 | missingVar;return {
| ^",
"stack": [
"getServerSideProps pages/blog/[slug].js (6:3)",
],
}
{
"description": "missingVar is not defined",
"environmentLabel": null,
"label": "Runtime ReferenceError",
"source": "../../test/integration/server-side-dev-errors/pages/blog/[slug].js (6:3) @ getServerSideProps
> 6 | missingVar;return {
| ^",
"stack": [
"getServerSideProps ../../test/integration/server-side-dev-errors/pages/blog/[slug].js (6:3)",
"async doRender src/server/route-modules/pages/pages-handler.ts (244:22)",
"async handleResponse src/server/route-modules/pages/pages-handler.ts (539:24)",
"async Module.handler src/server/route-modules/pages/pages-handler.ts (760:9)",
],
}
`)
await fs.writeFile(dynamicGsspPage, content)
......@@ -244,17 +253,18 @@ describe('server-side dev errors', () => {
}
await expect(browser).toDisplayRedbox(`
{
"description": "missingVar is not defined",
"environmentLabel": null,
"label": "Runtime ReferenceError",
"source": "pages/api/hello.js (2:3) @ handler
> 2 | missingVar;res.status(200).json({ hello: 'world' })
| ^",
"stack": [
"handler pages/api/hello.js (2:3)",
],
}
{
"description": "missingVar is not defined",
"environmentLabel": null,
"label": "Runtime ReferenceError",
"source": "../../test/integration/server-side-dev-errors/pages/api/hello.js (2:3) @ handler
> 2 | missingVar;res.status(200).json({ hello: 'world' })
| ^",
"stack": [
"handler ../../test/integration/server-side-dev-errors/pages/api/hello.js (2:3)",
"async Module.handler src/build/templates/pages-api.ts (157:7)",
],
}
`)
await fs.writeFile(apiPage, content, { flush: true })
......@@ -310,17 +320,18 @@ describe('server-side dev errors', () => {
}
await expect(browser).toDisplayRedbox(`
{
"description": "missingVar is not defined",
"environmentLabel": null,
"label": "Runtime ReferenceError",
"source": "pages/api/blog/[slug].js (2:3) @ handler
> 2 | missingVar;res.status(200).json({ slug: req.query.slug })
| ^",
"stack": [
"handler pages/api/blog/[slug].js (2:3)",
],
}
{
"description": "missingVar is not defined",
"environmentLabel": null,
"label": "Runtime ReferenceError",
"source": "../../test/integration/server-side-dev-errors/pages/api/blog/[slug].js (2:3) @ handler
> 2 | missingVar;res.status(200).json({ slug: req.query.slug })
| ^",
"stack": [
"handler ../../test/integration/server-side-dev-errors/pages/api/blog/[slug].js (2:3)",
"async Module.handler src/build/templates/pages-api.ts (157:7)",
],
}
`)
await fs.writeFile(dynamicApiPage, content, { flush: true })
......
......@@ -34,9 +34,7 @@ describe('build-output-prerender', () => {
if (isTurbopack) {
expect(getPreambleOutput(next.cliOutput)).toMatchInlineSnapshot(`
"▲ Next.js x.y.z (Turbopack)
- Cache Components enabled
- Experiments (use with caution):
✓ strictRouteTypes (enabled by \`__NEXT_EXPERIMENTAL_STRICT_ROUTE_TYPES\`)"
- Cache Components enabled"
`)
} else if (isRspack) {
expect(getPreambleOutput(next.cliOutput)).toMatchInlineSnapshot(`
......@@ -127,7 +125,6 @@ describe('build-output-prerender', () => {
- Experiments (use with caution):
⨯ prerenderEarlyExit (disabled by \`--debug-prerender\`)
✓ serverSourceMaps (enabled by \`--debug-prerender\`)
✓ strictRouteTypes (enabled by \`__NEXT_EXPERIMENTAL_STRICT_ROUTE_TYPES\`)
⨯ turbopackMinify (disabled by \`--debug-prerender\`)"
`)
} else if (isRspack) {
......@@ -242,11 +239,9 @@ describe('build-output-prerender', () => {
}
} else {
if (isTurbopack) {
expect(getPreambleOutput(next.cliOutput)).toMatchInlineSnapshot(`
"▲ Next.js x.y.z (Turbopack)
- Experiments (use with caution):
✓ strictRouteTypes (enabled by \`__NEXT_EXPERIMENTAL_STRICT_ROUTE_TYPES\`)"
`)
expect(getPreambleOutput(next.cliOutput)).toMatchInlineSnapshot(
`"▲ Next.js x.y.z (Turbopack)"`
)
} else if (isRspack) {
expect(getPreambleOutput(next.cliOutput)).toMatchInlineSnapshot(
`"▲ Next.js x.y.z (Rspack)"`
......@@ -303,7 +298,6 @@ describe('build-output-prerender', () => {
- Experiments (use with caution):
⨯ prerenderEarlyExit (disabled by \`--debug-prerender\`)
✓ serverSourceMaps (enabled by \`--debug-prerender\`)
✓ strictRouteTypes (enabled by \`__NEXT_EXPERIMENTAL_STRICT_ROUTE_TYPES\`)
⨯ turbopackMinify (disabled by \`--debug-prerender\`)"
`)
} else if (isRspack) {
......
......@@ -400,11 +400,7 @@ async fn parse_file_content(
inline_helpers: bool,
) -> Result<Vc<ParseResult>> {
let source_map: Arc<swc_core::common::SourceMap> = Default::default();
let (emitter, collector) = IssueEmitter::new(
source,
source_map.clone(),
Some(rcstr!("Ecmascript file had an error")),
);
let (emitter, collector) = IssueEmitter::new(source, source_map.clone(), None);
let handler = Handler::with_emitter(true, false, Box::new(emitter));
let (emitter, collector_parse) = IssueEmitter::new(
......
error - [analysis] /turbopack/crates/turbopack-tests/tests/snapshot/imports/duplicate-binding/input/index.js:3:16 Ecmascript file had an error
error - [analysis] /turbopack/crates/turbopack-tests/tests/snapshot/imports/duplicate-binding/input/index.js:3:16 the name `Table` is defined multiple times
1 | import { Table } from './table'
2 |
+ v---v
......@@ -6,6 +6,4 @@ error - [analysis] /turbopack/crates/turbopack-tests/tests/snapshot/imports/dupl
+ ^---^
4 | console.log(Table)
5 | }
6 |
the name `Table` is defined multiple times
\ No newline at end of file
6 |
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment