Skip to content

Commit

Permalink
Update error-recovery test snapshots for alternative bundler [2/n]
Browse files Browse the repository at this point in the history
  • Loading branch information
wbinnssmith committed Feb 23, 2025
1 parent 49c26c7 commit 6aa8c86
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ReactRefreshLogBox default syntax > runtime error 1`] = `
exports[`ReactRefreshLogBox default syntax > runtime error: isWin32-false--isRspack-false 1`] = `
"index.js (5:9) @ eval
3 | setInterval(() => {
Expand Down
50 changes: 45 additions & 5 deletions test/development/acceptance/error-recovery.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,11 +409,9 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {

await new Promise((resolve) => setTimeout(resolve, 1000))
await session.assertHasRedbox()
if (process.platform === 'win32') {
expect(await session.getRedboxSource()).toMatchSnapshot()
} else {
expect(await session.getRedboxSource()).toMatchSnapshot()
}
expect(await session.getRedboxSource()).toMatchSnapshot(
`isWin32-${process.platform === 'win32'}--isRspack-${Boolean(process.env.NEXT_RSPACK)}`
)

// Make a syntax error.
await session.patch(
Expand Down Expand Up @@ -446,6 +444,27 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
Expected '}', got '<eof>'"
`)
} else if (process.env.NEXT_RSPACK) {
expect(redboxSource).toMatchInlineSnapshot(`
"./index.js
× Module build failed:
├─▶ ×
│ │ x Expected '}', got '<eof>'
│ │ ,-[TEST_DIR/index.js:7:1]
│ │ 4 | i++
│ │ 5 | throw Error('no ' + i)
│ │ 6 | }, 1000)
│ │ 7 | export default function FunctionNamed() {
│ │ : ^
│ │ \`----
│ │
╰─▶ Syntax Error
Import trace for requested module:
./index.js
./pages/index.js"
`)
} else {
expect(redboxSource).toMatchInlineSnapshot(`
"./index.js
Expand Down Expand Up @@ -483,6 +502,27 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
Expected '}', got '<eof>'"
`)
} else if (process.env.NEXT_RSPACK) {
expect(redboxSource).toMatchInlineSnapshot(`
"./index.js
× Module build failed:
├─▶ ×
│ │ x Expected '}', got '<eof>'
│ │ ,-[TEST_DIR/index.js:7:1]
│ │ 4 | i++
│ │ 5 | throw Error('no ' + i)
│ │ 6 | }, 1000)
│ │ 7 | export default function FunctionNamed() {
│ │ : ^
│ │ \`----
│ │
╰─▶ Syntax Error
Import trace for requested module:
./index.js
./pages/index.js"
`)
} else {
expect(redboxSource).toMatchInlineSnapshot(`
"./index.js
Expand Down

0 comments on commit 6aa8c86

Please sign in to comment.