Skip to content

Commit 539c644

Browse files
authored
Update test snapshots for alternative bundler [5/n] (#76617)
Test Plan: `pnpm test-dev-rspack test/development/acceptance/ReactRefreshLogBox-app-doc.test.ts` passes
1 parent 5453818 commit 539c644

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

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

+61
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { FileRef, nextTestSetup } from 'e2e-utils'
33
import { outdent } from 'outdent'
44
import path from 'path'
55

6+
const isRspack = process.env.NEXT_RSPACK !== undefined
7+
68
describe('ReactRefreshLogBox _app _document', () => {
79
const { isTurbopack, next } = nextTestSetup({
810
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
@@ -120,6 +122,39 @@ describe('ReactRefreshLogBox _app _document', () => {
120122
"stack": [],
121123
}
122124
`)
125+
} else if (isRspack) {
126+
await expect({ browser, next }).toDisplayRedbox(`
127+
{
128+
"count": 1,
129+
"description": " × Module build failed:",
130+
"environmentLabel": null,
131+
"label": "Build Error",
132+
"source": "./pages/_app.js
133+
× Module build failed:
134+
├─▶ ×
135+
│ │ x Expression expected
136+
│ │ ,-[<FIXME-project-root>/pages/_app.js:2:1]
137+
│ │ 1 | function MyApp({ Component, pageProps }) {
138+
│ │ 2 | return <<Component {...pageProps} />;
139+
│ │ : ^
140+
│ │ 3 | }
141+
│ │ 4 | export default MyApp
142+
│ │ \`----
143+
│ │
144+
│ │ x Expression expected
145+
│ │ ,-[<FIXME-project-root>/pages/_app.js:2:1]
146+
│ │ 1 | function MyApp({ Component, pageProps }) {
147+
│ │ 2 | return <<Component {...pageProps} />;
148+
│ │ : ^^^^^^^^^
149+
│ │ 3 | }
150+
│ │ 4 | export default MyApp
151+
│ │ \`----
152+
│ │
153+
154+
╰─▶ Syntax Error",
155+
"stack": [],
156+
}
157+
`)
123158
} else {
124159
await expect(browser).toDisplayRedbox(`
125160
{
@@ -211,6 +246,32 @@ describe('ReactRefreshLogBox _app _document', () => {
211246
"stack": [],
212247
}
213248
`)
249+
} else if (isRspack) {
250+
await expect({ browser, next }).toDisplayRedbox(`
251+
{
252+
"count": 1,
253+
"description": " × Module build failed:",
254+
"environmentLabel": null,
255+
"label": "Build Error",
256+
"source": "./pages/_document.js
257+
× Module build failed:
258+
├─▶ ×
259+
│ │ x Unexpected token \`{\`. Expected identifier, string literal, numeric literal or [ for the computed key
260+
│ │ ,-[<FIXME-project-root>/pages/_document.js:3:1]
261+
│ │ 1 | import Document, { Html, Head, Main, NextScript } from 'next/document'
262+
│ │ 2 |
263+
│ │ 3 | class MyDocument extends Document {{
264+
│ │ : ^
265+
│ │ 4 | static async getInitialProps(ctx) {
266+
│ │ 5 | const initialProps = await Document.getInitialProps(ctx)
267+
│ │ 6 | return { ...initialProps }
268+
│ │ \`----
269+
│ │
270+
271+
╰─▶ Syntax Error",
272+
"stack": [],
273+
}
274+
`)
214275
} else {
215276
await expect(browser).toDisplayRedbox(`
216277
{

0 commit comments

Comments
 (0)