Commit 6aa0ee81 authored by Luke Sandberg's avatar Luke Sandberg

Update test snapshots for error message formatting changes

parent fc6e3f90
...@@ -743,11 +743,11 @@ describe('ReactRefreshLogBox', () => { ...@@ -743,11 +743,11 @@ describe('ReactRefreshLogBox', () => {
} else { } else {
await expect({ browser, next }).toDisplayRedbox(` await expect({ browser, next }).toDisplayRedbox(`
{ {
"description": "Parsing CSS source code failed", "description": "Syntax error: <FIXME-project-root>/index.module.css Unknown word",
"environmentLabel": null, "environmentLabel": null,
"label": "Build Error", "label": "Build Error",
"source": "./test/tmp/next-test-1770762033409-692/index.module.css (1:8) "source": "./index.module.css (1:1)
Parsing CSS source code failed Syntax error: <FIXME-project-root>/index.module.css Unknown word
> 1 | .button > 1 | .button
| ^", | ^",
"stack": [], "stack": [],
...@@ -804,21 +804,13 @@ describe('ReactRefreshLogBox', () => { ...@@ -804,21 +804,13 @@ describe('ReactRefreshLogBox', () => {
} else { } else {
await expect({ browser, next }).toDisplayRedbox(` await expect({ browser, next }).toDisplayRedbox(`
{ {
"description": "Transforming CSS failed", "description": "Syntax error: Selector "button" is not pure (pure selectors must contain at least one local class or id)",
"environmentLabel": null, "environmentLabel": null,
"label": "Build Error", "label": "Build Error",
"source": "./test/tmp/next-test-1770762033409-692/index.module.css "source": "./index.module.css (1:1)
Transforming CSS failed Syntax error: Selector "button" is not pure (pure selectors must contain at least one local class or id)
Selector "button" is not pure. Pure selectors must contain at least one local class or id. > 1 | button {}
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": [], "stack": [],
} }
`) `)
...@@ -1430,11 +1422,11 @@ describe('ReactRefreshLogBox', () => { ...@@ -1430,11 +1422,11 @@ describe('ReactRefreshLogBox', () => {
"description": "anonymous error!", "description": "anonymous error!",
"environmentLabel": null, "environmentLabel": null,
"label": "Runtime Error", "label": "Runtime Error",
"source": "pages/index.js (3:11) @ <unknown> "source": "pages/index.js (3:11) @ eval
> 3 | throw new Error("anonymous error!"); > 3 | throw new Error("anonymous error!");
| ^", | ^",
"stack": [ "stack": [
"<unknown> pages/index.js (3:11)", "eval pages/index.js (3:11)",
"Array.map <anonymous>", "Array.map <anonymous>",
"Page pages/index.js (2:13)", "Page pages/index.js (2:13)",
], ],
......
...@@ -123,7 +123,6 @@ describe('Error overlay for hydration errors in Pages router', () => { ...@@ -123,7 +123,6 @@ describe('Error overlay for hydration errors in Pages router', () => {
"stack": [ "stack": [
"main <anonymous>", "main <anonymous>",
"Mismatch index.js (5:9)", "Mismatch index.js (5:9)",
"App.render ../../../packages/next/src/pages/_app.tsx (44:12)",
], ],
} }
`) `)
...@@ -227,7 +226,6 @@ describe('Error overlay for hydration errors in Pages router', () => { ...@@ -227,7 +226,6 @@ describe('Error overlay for hydration errors in Pages router', () => {
"stack": [ "stack": [
"main <anonymous>", "main <anonymous>",
"Mismatch index.js (5:20)", "Mismatch index.js (5:20)",
"App.render ../../../packages/next/src/pages/_app.tsx (44:12)",
], ],
} }
`) `)
...@@ -321,7 +319,6 @@ describe('Error overlay for hydration errors in Pages router', () => { ...@@ -321,7 +319,6 @@ describe('Error overlay for hydration errors in Pages router', () => {
"stack": [ "stack": [
"div <anonymous>", "div <anonymous>",
"Mismatch index.js (4:5)", "Mismatch index.js (4:5)",
"App.render ../../../packages/next/src/pages/_app.tsx (44:12)",
], ],
} }
`) `)
...@@ -394,7 +391,6 @@ describe('Error overlay for hydration errors in Pages router', () => { ...@@ -394,7 +391,6 @@ describe('Error overlay for hydration errors in Pages router', () => {
"stack": [ "stack": [
"div <anonymous>", "div <anonymous>",
"Mismatch index.js (4:5)", "Mismatch index.js (4:5)",
"App.render ../../../packages/next/src/pages/_app.tsx (44:12)",
], ],
} }
`) `)
...@@ -465,7 +461,6 @@ describe('Error overlay for hydration errors in Pages router', () => { ...@@ -465,7 +461,6 @@ describe('Error overlay for hydration errors in Pages router', () => {
"stack": [ "stack": [
"div <anonymous>", "div <anonymous>",
"Mismatch index.js (3:10)", "Mismatch index.js (3:10)",
"App.render ../../../packages/next/src/pages/_app.tsx (44:12)",
], ],
} }
`) `)
...@@ -558,7 +553,6 @@ describe('Error overlay for hydration errors in Pages router', () => { ...@@ -558,7 +553,6 @@ describe('Error overlay for hydration errors in Pages router', () => {
"stack": [ "stack": [
"table <anonymous>", "table <anonymous>",
"Page index.js (3:5)", "Page index.js (3:5)",
"App.render ../../../packages/next/src/pages/_app.tsx (44:12)",
], ],
} }
`) `)
...@@ -646,7 +640,6 @@ describe('Error overlay for hydration errors in Pages router', () => { ...@@ -646,7 +640,6 @@ describe('Error overlay for hydration errors in Pages router', () => {
"stack": [ "stack": [
"table <anonymous>", "table <anonymous>",
"Page index.js (3:5)", "Page index.js (3:5)",
"App.render ../../../packages/next/src/pages/_app.tsx (44:12)",
], ],
} }
`) `)
...@@ -742,7 +735,6 @@ describe('Error overlay for hydration errors in Pages router', () => { ...@@ -742,7 +735,6 @@ describe('Error overlay for hydration errors in Pages router', () => {
"stack": [ "stack": [
"main <anonymous>", "main <anonymous>",
"Mismatch index.js (8:22)", "Mismatch index.js (8:22)",
"App.render ../../../packages/next/src/pages/_app.tsx (44:12)",
], ],
} }
`) `)
...@@ -863,7 +855,6 @@ describe('Error overlay for hydration errors in Pages router', () => { ...@@ -863,7 +855,6 @@ describe('Error overlay for hydration errors in Pages router', () => {
"stack": [ "stack": [
"p <anonymous>", "p <anonymous>",
"Page index.js (4:7)", "Page index.js (4:7)",
"App.render ../../../packages/next/src/pages/_app.tsx (44:12)",
], ],
} }
`) `)
...@@ -959,7 +950,6 @@ describe('Error overlay for hydration errors in Pages router', () => { ...@@ -959,7 +950,6 @@ describe('Error overlay for hydration errors in Pages router', () => {
"stack": [ "stack": [
"div <anonymous>", "div <anonymous>",
"Page index.js (6:11)", "Page index.js (6:11)",
"App.render ../../../packages/next/src/pages/_app.tsx (44:12)",
], ],
} }
`) `)
...@@ -1043,7 +1033,6 @@ describe('Error overlay for hydration errors in Pages router', () => { ...@@ -1043,7 +1033,6 @@ describe('Error overlay for hydration errors in Pages router', () => {
"stack": [ "stack": [
"tr <anonymous>", "tr <anonymous>",
"Page index.js (2:15)", "Page index.js (2:15)",
"App.render ../../../packages/next/src/pages/_app.tsx (44:12)",
], ],
} }
`) `)
...@@ -1141,7 +1130,6 @@ describe('Error overlay for hydration errors in Pages router', () => { ...@@ -1141,7 +1130,6 @@ describe('Error overlay for hydration errors in Pages router', () => {
"stack": [ "stack": [
"p <anonymous>", "p <anonymous>",
"Page index.js (3:32)", "Page index.js (3:32)",
"App.render ../../../packages/next/src/pages/_app.tsx (44:12)",
], ],
} }
`) `)
......
...@@ -33,17 +33,8 @@ describe('Client Navigation', () => { ...@@ -33,17 +33,8 @@ describe('Client Navigation', () => {
"description": ""EmptyInitialPropsPage.getInitialProps()" should resolve to an object. But found "null" instead.", "description": ""EmptyInitialPropsPage.getInitialProps()" should resolve to an object. But found "null" instead.",
"environmentLabel": null, "environmentLabel": null,
"label": "Runtime Error", "label": "Runtime Error",
"source": "../../../packages/next/src/shared/lib/utils.ts (397:11) @ loadGetInitialProps "source": null,
> 397 | throw new Error(message) "stack": [],
| ^",
"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([ expect(pageErrors).toEqual([
...@@ -315,11 +306,15 @@ describe('Client Navigation', () => { ...@@ -315,11 +306,15 @@ describe('Client Navigation', () => {
} else { } else {
await expect(browser).toDisplayRedbox(` await expect(browser).toDisplayRedbox(`
{ {
"description": "Cannot read properties of null (reading 'useInsertionEffect')", "description": "An Expected error occurred",
"environmentLabel": null, "environmentLabel": null,
"label": "Runtime TypeError", "label": "Runtime Error",
"source": null, "source": "pages/error-inside-browser-page.js (5:13) @ ErrorInRenderPage.render
"stack": [], > 5 | throw new Error('An Expected error occurred')
| ^",
"stack": [
"ErrorInRenderPage.render pages/error-inside-browser-page.js (5:13)",
],
} }
`) `)
} }
...@@ -355,11 +350,15 @@ describe('Client Navigation', () => { ...@@ -355,11 +350,15 @@ describe('Client Navigation', () => {
if (isTurbopack) { if (isTurbopack) {
await expect(browser).toDisplayRedbox(` await expect(browser).toDisplayRedbox(`
{ {
"description": "Cannot read properties of null (reading 'useInsertionEffect')", "description": "An Expected error occurred",
"environmentLabel": null, "environmentLabel": null,
"label": "Runtime TypeError", "label": "Runtime Error",
"source": null, "source": "pages/error-in-the-browser-global-scope.js (2:9) @ module evaluation
"stack": [], > 2 | throw new Error('An Expected error occurred')
| ^",
"stack": [
"module evaluation pages/error-in-the-browser-global-scope.js (2:9)",
],
} }
`) `)
} else if (isRspack) { } else if (isRspack) {
......
...@@ -38,7 +38,7 @@ describe('cache-components-segment-configs', () => { ...@@ -38,7 +38,7 @@ describe('cache-components-segment-configs', () => {
) )
} else { } else {
expect(redbox.description).toMatchInlineSnapshot( expect(redbox.description).toMatchInlineSnapshot(
`"Route segment config "revalidate" is not compatible with \`nextConfig.cacheComponents\`. Please remove it."` `" x Route segment config "revalidate" is not compatible with \`nextConfig.cacheComponents\`. Please remove it."`
) )
} }
expect(redbox.source).toContain( expect(redbox.source).toContain(
...@@ -99,7 +99,7 @@ describe('cache-components-segment-configs', () => { ...@@ -99,7 +99,7 @@ describe('cache-components-segment-configs', () => {
) )
} else { } else {
expect(redbox.description).toMatchInlineSnapshot( expect(redbox.description).toMatchInlineSnapshot(
`"Route segment config "revalidate" is not compatible with \`nextConfig.cacheComponents\`. Please remove it."` `" x Route segment config "runtime" is not compatible with \`nextConfig.cacheComponents\`. Please remove it."`
) )
} }
expect(redbox.source).toContain( expect(redbox.source).toContain(
......
...@@ -88,14 +88,11 @@ describe('server-side dev errors', () => { ...@@ -88,14 +88,11 @@ describe('server-side dev errors', () => {
"description": "missingVar is not defined", "description": "missingVar is not defined",
"environmentLabel": null, "environmentLabel": null,
"label": "Runtime ReferenceError", "label": "Runtime ReferenceError",
"source": "../../test/integration/server-side-dev-errors/pages/gsp.js (6:3) @ getStaticProps "source": "pages/gsp.js (6:3) @ getStaticProps
> 6 | missingVar;return { > 6 | missingVar;return {
| ^", | ^",
"stack": [ "stack": [
"getStaticProps ../../test/integration/server-side-dev-errors/pages/gsp.js (6:3)", "getStaticProps 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)",
], ],
} }
`) `)
...@@ -141,14 +138,11 @@ describe('server-side dev errors', () => { ...@@ -141,14 +138,11 @@ describe('server-side dev errors', () => {
"description": "missingVar is not defined", "description": "missingVar is not defined",
"environmentLabel": null, "environmentLabel": null,
"label": "Runtime ReferenceError", "label": "Runtime ReferenceError",
"source": "../../test/integration/server-side-dev-errors/pages/gssp.js (6:3) @ getServerSideProps "source": "pages/gssp.js (6:3) @ getServerSideProps
> 6 | missingVar;return { > 6 | missingVar;return {
| ^", | ^",
"stack": [ "stack": [
"getServerSideProps ../../test/integration/server-side-dev-errors/pages/gssp.js (6:3)", "getServerSideProps 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)",
], ],
} }
`) `)
...@@ -194,14 +188,11 @@ describe('server-side dev errors', () => { ...@@ -194,14 +188,11 @@ describe('server-side dev errors', () => {
"description": "missingVar is not defined", "description": "missingVar is not defined",
"environmentLabel": null, "environmentLabel": null,
"label": "Runtime ReferenceError", "label": "Runtime ReferenceError",
"source": "../../test/integration/server-side-dev-errors/pages/blog/[slug].js (6:3) @ getServerSideProps "source": "pages/blog/[slug].js (6:3) @ getServerSideProps
> 6 | missingVar;return { > 6 | missingVar;return {
| ^", | ^",
"stack": [ "stack": [
"getServerSideProps ../../test/integration/server-side-dev-errors/pages/blog/[slug].js (6:3)", "getServerSideProps 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)",
], ],
} }
`) `)
...@@ -257,12 +248,11 @@ describe('server-side dev errors', () => { ...@@ -257,12 +248,11 @@ describe('server-side dev errors', () => {
"description": "missingVar is not defined", "description": "missingVar is not defined",
"environmentLabel": null, "environmentLabel": null,
"label": "Runtime ReferenceError", "label": "Runtime ReferenceError",
"source": "../../test/integration/server-side-dev-errors/pages/api/hello.js (2:3) @ handler "source": "pages/api/hello.js (2:3) @ handler
> 2 | missingVar;res.status(200).json({ hello: 'world' }) > 2 | missingVar;res.status(200).json({ hello: 'world' })
| ^", | ^",
"stack": [ "stack": [
"handler ../../test/integration/server-side-dev-errors/pages/api/hello.js (2:3)", "handler pages/api/hello.js (2:3)",
"async Module.handler src/build/templates/pages-api.ts (157:7)",
], ],
} }
`) `)
...@@ -324,12 +314,11 @@ describe('server-side dev errors', () => { ...@@ -324,12 +314,11 @@ describe('server-side dev errors', () => {
"description": "missingVar is not defined", "description": "missingVar is not defined",
"environmentLabel": null, "environmentLabel": null,
"label": "Runtime ReferenceError", "label": "Runtime ReferenceError",
"source": "../../test/integration/server-side-dev-errors/pages/api/blog/[slug].js (2:3) @ handler "source": "pages/api/blog/[slug].js (2:3) @ handler
> 2 | missingVar;res.status(200).json({ slug: req.query.slug }) > 2 | missingVar;res.status(200).json({ slug: req.query.slug })
| ^", | ^",
"stack": [ "stack": [
"handler ../../test/integration/server-side-dev-errors/pages/api/blog/[slug].js (2:3)", "handler pages/api/blog/[slug].js (2:3)",
"async Module.handler src/build/templates/pages-api.ts (157:7)",
], ],
} }
`) `)
......
...@@ -34,7 +34,9 @@ describe('build-output-prerender', () => { ...@@ -34,7 +34,9 @@ describe('build-output-prerender', () => {
if (isTurbopack) { if (isTurbopack) {
expect(getPreambleOutput(next.cliOutput)).toMatchInlineSnapshot(` expect(getPreambleOutput(next.cliOutput)).toMatchInlineSnapshot(`
"▲ Next.js x.y.z (Turbopack) "▲ Next.js x.y.z (Turbopack)
- Cache Components enabled" - Cache Components enabled
- Experiments (use with caution):
✓ strictRouteTypes (enabled by \`__NEXT_EXPERIMENTAL_STRICT_ROUTE_TYPES\`)"
`) `)
} else if (isRspack) { } else if (isRspack) {
expect(getPreambleOutput(next.cliOutput)).toMatchInlineSnapshot(` expect(getPreambleOutput(next.cliOutput)).toMatchInlineSnapshot(`
...@@ -125,6 +127,7 @@ describe('build-output-prerender', () => { ...@@ -125,6 +127,7 @@ describe('build-output-prerender', () => {
- Experiments (use with caution): - Experiments (use with caution):
⨯ prerenderEarlyExit (disabled by \`--debug-prerender\`) ⨯ prerenderEarlyExit (disabled by \`--debug-prerender\`)
✓ serverSourceMaps (enabled by \`--debug-prerender\`) ✓ serverSourceMaps (enabled by \`--debug-prerender\`)
✓ strictRouteTypes (enabled by \`__NEXT_EXPERIMENTAL_STRICT_ROUTE_TYPES\`)
⨯ turbopackMinify (disabled by \`--debug-prerender\`)" ⨯ turbopackMinify (disabled by \`--debug-prerender\`)"
`) `)
} else if (isRspack) { } else if (isRspack) {
...@@ -239,9 +242,11 @@ describe('build-output-prerender', () => { ...@@ -239,9 +242,11 @@ describe('build-output-prerender', () => {
} }
} else { } else {
if (isTurbopack) { if (isTurbopack) {
expect(getPreambleOutput(next.cliOutput)).toMatchInlineSnapshot( expect(getPreambleOutput(next.cliOutput)).toMatchInlineSnapshot(`
`"▲ Next.js x.y.z (Turbopack)"` "▲ Next.js x.y.z (Turbopack)
) - Experiments (use with caution):
✓ strictRouteTypes (enabled by \`__NEXT_EXPERIMENTAL_STRICT_ROUTE_TYPES\`)"
`)
} else if (isRspack) { } else if (isRspack) {
expect(getPreambleOutput(next.cliOutput)).toMatchInlineSnapshot( expect(getPreambleOutput(next.cliOutput)).toMatchInlineSnapshot(
`"▲ Next.js x.y.z (Rspack)"` `"▲ Next.js x.y.z (Rspack)"`
...@@ -298,6 +303,7 @@ describe('build-output-prerender', () => { ...@@ -298,6 +303,7 @@ describe('build-output-prerender', () => {
- Experiments (use with caution): - Experiments (use with caution):
⨯ prerenderEarlyExit (disabled by \`--debug-prerender\`) ⨯ prerenderEarlyExit (disabled by \`--debug-prerender\`)
✓ serverSourceMaps (enabled by \`--debug-prerender\`) ✓ serverSourceMaps (enabled by \`--debug-prerender\`)
✓ strictRouteTypes (enabled by \`__NEXT_EXPERIMENTAL_STRICT_ROUTE_TYPES\`)
⨯ turbopackMinify (disabled by \`--debug-prerender\`)" ⨯ turbopackMinify (disabled by \`--debug-prerender\`)"
`) `)
} else if (isRspack) { } else if (isRspack) {
......
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