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 21, 2025
1 parent 6fad65f commit 27e94d4
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ exports[`ReactRefreshLogBox default syntax > runtime error 1`] = `
8 | return <div />"
`;
exports[`ReactRefreshLogBox default syntax > runtime error: isWin32-false--isRspack-true 1`] = `
"index.js (5:9) @ <unknown>
3 | setInterval(() => {
4 | i++
> 5 | throw Error('no ' + i)
| ^
6 | }, 1000)
7 | export default function FunctionNamed() {
8 | return <div />"
`;
exports[`ReactRefreshLogBox turbo syntax > runtime error 1`] = `
"index.js (5:9) @ eval
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 27e94d4

Please # to comment.