Skip to content

Commit 3eaad96

Browse files
committed
chore: update snapshot
1 parent 891e1fd commit 3eaad96

File tree

18 files changed

+106
-123
lines changed

18 files changed

+106
-123
lines changed

packages/next/src/shared/lib/format-webpack-messages.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ function formatMessage(
5959
body = body.slice(0, breakingChangeIndex)
6060
}
6161

62+
// TODO: Rspack currently doesn't populate moduleName correctly in some cases,
63+
// fall back to moduleIdentifier as a workaround
64+
if (!message.moduleName && !message.file) {
65+
message.moduleName = message.moduleIdentifier
66+
}
67+
6268
message =
6369
(message.moduleName ? stripAnsi(message.moduleName) + '\n' : '') +
6470
(message.file ? stripAnsi(message.file) + '\n' : '') +

test/development/acceptance-app/ReactRefreshLogBox.test.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,10 @@ describe('ReactRefreshLogBox app', () => {
294294
} else if (isRspack) {
295295
await expect({ browser, next }).toDisplayRedbox(`
296296
{
297-
"description": " × Module build failed:",
297+
"description": " ╰─▶ × Error: x Unexpected token. Did you mean \`{'}'}\` or \`}\`?",
298298
"environmentLabel": null,
299299
"label": "Build Error",
300300
"source": "./index.js
301-
× Module build failed:
302301
╰─▶ × Error: x Unexpected token. Did you mean \`{'}'}\` or \`}\`?
303302
│ ,-[7:1]
304303
│ 4 | <p>lol</p>
@@ -495,11 +494,10 @@ describe('ReactRefreshLogBox app', () => {
495494
} else if (isRspack) {
496495
await expect({ browser, next }).toDisplayRedbox(`
497496
{
498-
"description": " × Module build failed:",
497+
"description": " ╰─▶ × SyntaxError",
499498
"environmentLabel": null,
500499
"label": "Build Error",
501500
"source": "./index.module.css
502-
× Module build failed:
503501
╰─▶ × SyntaxError
504502
505503
│ (1:1) <FIXME-project-root>/index.module.css Unknown word
@@ -559,11 +557,10 @@ describe('ReactRefreshLogBox app', () => {
559557
} else if (isRspack) {
560558
await expect(browser).toDisplayRedbox(`
561559
{
562-
"description": " × Module build failed:",
560+
"description": " ╰─▶ × CssSyntaxError",
563561
"environmentLabel": null,
564562
"label": "Build Error",
565563
"source": "./index.module.css
566-
× Module build failed:
567564
╰─▶ × CssSyntaxError
568565
569566
│ (1:1) Selector "button" is not pure (pure selectors must contain at least one local class or id)
@@ -1062,11 +1059,11 @@ describe('ReactRefreshLogBox app', () => {
10621059
"description": "test",
10631060
"environmentLabel": null,
10641061
"label": "Runtime Error",
1065-
"source": "index.js (3:11) @ default
1062+
"source": "index.js (3:11) @ __rspack_default_export
10661063
> 3 | throw new Error('test')
10671064
| ^",
10681065
"stack": [
1069-
"default index.js (3:11)",
1066+
"__rspack_default_export index.js (3:11)",
10701067
"Page app/page.js (4:10)",
10711068
],
10721069
}
@@ -1506,11 +1503,10 @@ describe('ReactRefreshLogBox app', () => {
15061503
} else if (isRspack) {
15071504
await expect(browser).toDisplayRedbox(`
15081505
{
1509-
"description": " ╰─▶ × Error: RspackResolver(NotFound("./boom.css"))",
1506+
"description": "Failed to compile",
15101507
"environmentLabel": null,
15111508
"label": "Build Error",
1512-
"source": "× Module build failed:
1513-
╰─▶ × Error: RspackResolver(NotFound("./boom.css"))",
1509+
"source": "╰─▶ × Error: RspackResolver(NotFound("./boom.css"))",
15141510
"stack": [],
15151511
}
15161512
`)

test/development/acceptance-app/ReactRefreshLogBoxMisc.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,10 @@ describe('ReactRefreshLogBox app', () => {
4747
} else if (isRspack) {
4848
await expect(browser).toDisplayRedbox(`
4949
{
50-
"description": " × Module build failed:",
50+
"description": " ╰─▶ × Error: x "getStaticProps" is not supported in app/. Read more: https://nextjs.org/docs/app/building-your-application/data-fetching",
5151
"environmentLabel": null,
5252
"label": "Build Error",
5353
"source": "./app/page.js
54-
× Module build failed:
5554
╰─▶ × Error: x "getStaticProps" is not supported in app/. Read more: https://nextjs.org/docs/app/building-your-application/data-fetching
5655
│ |
5756

test/development/acceptance-app/error-recovery.test.ts

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,10 @@ describe('Error recovery app', () => {
5656
} else if (isRspack) {
5757
await expect({ browser, next }).toDisplayRedbox(`
5858
{
59-
"description": " × Module build failed:",
59+
"description": " ╰─▶ × Error: x Expected '>', got '<eof>'",
6060
"environmentLabel": null,
6161
"label": "Build Error",
6262
"source": "./index.js
63-
× Module build failed:
6463
╰─▶ × Error: x Expected '>', got '<eof>'
6564
│ ,----
6665
│ 1 | export default () => <div/
@@ -150,11 +149,10 @@ describe('Error recovery app', () => {
150149
} else if (isRspack) {
151150
await expect(browser).toDisplayRedbox(`
152151
{
153-
"description": " × Module build failed:",
152+
"description": " ╰─▶ × Error: x Expected '}', got '<eof>'",
154153
"environmentLabel": null,
155154
"label": "Build Error",
156155
"source": "./app/server/page.js
157-
× Module build failed:
158156
╰─▶ × Error: x Expected '}', got '<eof>'
159157
│ ,-[2:1]
160158
│ 1 | export default function Page() {
@@ -235,11 +233,10 @@ describe('Error recovery app', () => {
235233
} else if (isRspack) {
236234
await expect(browser).toDisplayRedbox(`
237235
{
238-
"description": " × Module build failed:",
236+
"description": " ╰─▶ × Error: x Expected '}', got '<eof>'",
239237
"environmentLabel": null,
240238
"label": "Build Error",
241239
"source": "./app/client/page.js
242-
× Module build failed:
243240
╰─▶ × Error: x Expected '}', got '<eof>'
244241
│ ,-[2:1]
245242
│ 1 | export default function Page() {
@@ -671,11 +668,10 @@ describe('Error recovery app', () => {
671668
} else if (isRspack) {
672669
await expect(browser).toDisplayRedbox(`
673670
{
674-
"description": " × Module build failed:",
671+
"description": " ╰─▶ × Error: x Expected '}', got '<eof>'",
675672
"environmentLabel": null,
676673
"label": "Build Error",
677674
"source": "./index.js
678-
× Module build failed:
679675
╰─▶ × Error: x Expected '}', got '<eof>'
680676
│ ,-[10:1]
681677
│ 7 | throw Error('no ' + i)
@@ -732,11 +728,10 @@ describe('Error recovery app', () => {
732728
} else if (isRspack) {
733729
await expect(browser).toDisplayRedbox(`
734730
{
735-
"description": " × Module build failed:",
731+
"description": " ╰─▶ × Error: x Expected '}', got '<eof>'",
736732
"environmentLabel": null,
737733
"label": "Build Error",
738734
"source": "./index.js
739-
× Module build failed:
740735
╰─▶ × Error: x Expected '}', got '<eof>'
741736
│ ,-[10:1]
742737
│ 7 | throw Error('no ' + i)
@@ -925,11 +920,10 @@ describe('Error recovery app', () => {
925920
} else if (isRspack) {
926921
await expect({ browser, next }).toDisplayRedbox(`
927922
{
928-
"description": " × Module build failed:",
923+
"description": " ╰─▶ × Error: x Expected '{', got 'return'",
929924
"environmentLabel": null,
930925
"label": "Build Error",
931926
"source": "./index.js
932-
× Module build failed:
933927
╰─▶ × Error: x Expected '{', got 'return'
934928
│ ,-[5:1]
935929
│ 2 |
@@ -1009,11 +1003,10 @@ describe('Error recovery app', () => {
10091003
} else if (isRspack) {
10101004
await expect(browser).toDisplayRedbox(`
10111005
{
1012-
"description": " × Module build failed:",
1006+
"description": " ╰─▶ × Error: x Expected '{', got 'throw'",
10131007
"environmentLabel": null,
10141008
"label": "Build Error",
10151009
"source": "./index.js
1016-
× Module build failed:
10171010
╰─▶ × Error: x Expected '{', got 'throw'
10181011
│ ,-[5:1]
10191012
│ 2 |
@@ -1136,11 +1129,10 @@ describe('Error recovery app', () => {
11361129
} else if (isRspack) {
11371130
await expect(browser).toDisplayRedbox(`
11381131
{
1139-
"description": " × Module build failed:",
1132+
"description": " ╰─▶ × Error: x Expected '}', got '<eof>'",
11401133
"environmentLabel": null,
11411134
"label": "Build Error",
11421135
"source": "./app/page.js
1143-
× Module build failed:
11441136
╰─▶ × Error: x Expected '}', got '<eof>'
11451137
│ ,----
11461138
│ 1 | {{{

test/development/acceptance/ReactRefreshLogBox-app-doc.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,10 @@ describe('ReactRefreshLogBox _app _document', () => {
119119
} else if (isRspack) {
120120
await expect({ browser, next }).toDisplayRedbox(`
121121
{
122-
"description": " × Module build failed:",
122+
"description": " ╰─▶ × Error: x Expression expected",
123123
"environmentLabel": null,
124124
"label": "Build Error",
125125
"source": "./pages/_app.js
126-
× Module build failed:
127126
╰─▶ × Error: x Expression expected
128127
│ ,-[2:1]
129128
│ 1 | function MyApp({ Component, pageProps }) {
@@ -239,11 +238,10 @@ describe('ReactRefreshLogBox _app _document', () => {
239238
} else if (isRspack) {
240239
await expect({ browser, next }).toDisplayRedbox(`
241240
{
242-
"description": " × Module build failed:",
241+
"description": " ╰─▶ × Error: x Unexpected token \`{\`. Expected identifier, string literal, numeric literal or [ for the computed key",
243242
"environmentLabel": null,
244243
"label": "Build Error",
245244
"source": "./pages/_document.js
246-
× Module build failed:
247245
╰─▶ × Error: x Unexpected token \`{\`. Expected identifier, string literal, numeric literal or [ for the computed key
248246
│ ,-[3:1]
249247
│ 1 | import Document, { Html, Head, Main, NextScript } from 'next/document'

test/development/acceptance/ReactRefreshLogBox.test.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -455,11 +455,10 @@ describe('ReactRefreshLogBox', () => {
455455
} else if (isRspack) {
456456
await expect(browser).toDisplayRedbox(`
457457
{
458-
"description": " × Module build failed:",
458+
"description": " ╰─▶ × Error: x Unexpected token. Did you mean \`{'}'}\` or \`&rbrace;\`?",
459459
"environmentLabel": null,
460460
"label": "Build Error",
461461
"source": "./index.js
462-
× Module build failed:
463462
╰─▶ × Error: x Unexpected token. Did you mean \`{'}'}\` or \`&rbrace;\`?
464463
│ ,-[7:1]
465464
│ 4 | <p>lol</p>
@@ -709,11 +708,10 @@ describe('ReactRefreshLogBox', () => {
709708
} else if (isRspack) {
710709
await expect({ browser, next }).toDisplayRedbox(`
711710
{
712-
"description": " × Module build failed:",
711+
"description": " ╰─▶ × SyntaxError",
713712
"environmentLabel": null,
714713
"label": "Build Error",
715714
"source": "./index.module.css
716-
× Module build failed:
717715
╰─▶ × SyntaxError
718716
719717
│ (1:1) <FIXME-project-root>/index.module.css Unknown word
@@ -771,11 +769,10 @@ describe('ReactRefreshLogBox', () => {
771769
} else if (isRspack) {
772770
await expect(browser).toDisplayRedbox(`
773771
{
774-
"description": " × Module build failed:",
772+
"description": " ╰─▶ × CssSyntaxError",
775773
"environmentLabel": null,
776774
"label": "Build Error",
777775
"source": "./index.module.css
778-
× Module build failed:
779776
╰─▶ × CssSyntaxError
780777
781778
│ (1:1) Selector "button" is not pure (pure selectors must contain at least one local class or id)

test/development/acceptance/ReactRefreshRegression.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,11 +301,11 @@ describe('ReactRefreshRegression', () => {
301301
"description": "boom",
302302
"environmentLabel": null,
303303
"label": "Runtime Error",
304-
"source": "pages/index.js (1:36) @ default
304+
"source": "pages/index.js (1:36) @ __rspack_default_export
305305
> 1 | export default function () { throw new Error('boom'); }
306306
| ^",
307307
"stack": [
308-
"default pages/index.js (1:36)",
308+
"__rspack_default_export pages/index.js (1:36)",
309309
],
310310
}
311311
`)

test/development/acceptance/error-recovery.test.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,10 @@ describe('pages/ error recovery', () => {
5858
} else if (isRspack) {
5959
await expect({ browser, next }).toDisplayRedbox(`
6060
{
61-
"description": " × Module build failed:",
61+
"description": " ╰─▶ × Error: x Expected '>', got '<eof>'",
6262
"environmentLabel": null,
6363
"label": "Build Error",
6464
"source": "./index.js
65-
× Module build failed:
6665
╰─▶ × Error: x Expected '>', got '<eof>'
6766
│ ,----
6867
│ 1 | export default () => <div/
@@ -403,11 +402,10 @@ describe('pages/ error recovery', () => {
403402
} else if (isRspack) {
404403
await expect({ browser, next }).toDisplayRedbox(`
405404
{
406-
"description": " × Module build failed:",
405+
"description": " ╰─▶ × Error: x Expected '{', got 'return'",
407406
"environmentLabel": null,
408407
"label": "Build Error",
409408
"source": "./index.js
410-
× Module build failed:
411409
╰─▶ × Error: x Expected '{', got 'return'
412410
│ ,-[5:1]
413411
│ 2 |
@@ -488,11 +486,10 @@ describe('pages/ error recovery', () => {
488486
} else if (isRspack) {
489487
await expect({ browser, next }).toDisplayRedbox(`
490488
{
491-
"description": " × Module build failed:",
489+
"description": " ╰─▶ × Error: x Expected '{', got 'throw'",
492490
"environmentLabel": null,
493491
"label": "Build Error",
494492
"source": "./index.js
495-
× Module build failed:
496493
╰─▶ × Error: x Expected '{', got 'throw'
497494
│ ,-[5:1]
498495
│ 2 |
@@ -823,11 +820,10 @@ describe('pages/ error recovery', () => {
823820
} else if (isRspack) {
824821
await expect({ browser, next }).toDisplayRedbox(`
825822
{
826-
"description": " × Module build failed:",
823+
"description": " ╰─▶ × Error: x Expected '}', got '<eof>'",
827824
"environmentLabel": null,
828825
"label": "Build Error",
829826
"source": "./index.js
830-
× Module build failed:
831827
╰─▶ × Error: x Expected '}', got '<eof>'
832828
│ ,-[7:1]
833829
│ 4 | i++
@@ -889,11 +885,10 @@ describe('pages/ error recovery', () => {
889885
} else if (isRspack) {
890886
await expect({ browser, next }).toDisplayRedbox(`
891887
{
892-
"description": " × Module build failed:",
888+
"description": " ╰─▶ × Error: x Expected '}', got '<eof>'",
893889
"environmentLabel": null,
894890
"label": "Build Error",
895891
"source": "./index.js
896-
× Module build failed:
897892
╰─▶ × Error: x Expected '}', got '<eof>'
898893
│ ,-[7:1]
899894
│ 4 | i++

test/development/acceptance/server-component-compiler-errors-in-pages.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ describe('Error Overlay for server components compiler errors in pages', () => {
8181
)
8282
).toMatchInlineSnapshot(`
8383
"./components/Comp.js
84-
× Module build failed:
8584
╰─▶ × Error: x 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
8685
│ |
8786
@@ -165,7 +164,6 @@ describe('Error Overlay for server components compiler errors in pages', () => {
165164
)
166165
).toMatchInlineSnapshot(`
167166
"./components/Comp.js
168-
× Module build failed:
169167
╰─▶ × Error: x 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
170168
│ |
171169
@@ -251,7 +249,6 @@ describe('Error Overlay for server components compiler errors in pages', () => {
251249
)
252250
).toMatchInlineSnapshot(`
253251
"./components/Comp.js
254-
× Module build failed:
255252
╰─▶ × Error: x 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
256253
│ |
257254
@@ -346,7 +343,6 @@ describe('Error Overlay for server components compiler errors in pages', () => {
346343
)
347344
).toMatchInlineSnapshot(`
348345
"./components/Comp.js
349-
× Module build failed:
350346
╰─▶ × Error: x 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
351347
│ |
352348

test/development/app-dir/cache-components-dev-errors/cache-components-dev-errors.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,10 @@ describe('Cache Components Dev Errors', () => {
151151
} else if (isRspack) {
152152
await expect(browser).toDisplayRedbox(`
153153
{
154-
"description": " × Module build failed:",
154+
"description": " ╰─▶ × Error: x Route segment config "revalidate" is not compatible with \`nextConfig.cacheComponents\`. Please remove it.",
155155
"environmentLabel": null,
156156
"label": "Build Error",
157157
"source": "./app/page.tsx
158-
× Module build failed:
159158
╰─▶ × Error: x Route segment config "revalidate" is not compatible with \`nextConfig.cacheComponents\`. Please remove it.
160159
│ ,-[1:1]
161160
│ 1 | export const revalidate = 10

0 commit comments

Comments
 (0)