diff --git a/test/development/acceptance/__snapshots__/error-recovery.test.ts.snap b/test/development/acceptance/__snapshots__/error-recovery.test.ts.snap
index 8c12e2cd48138..ec3621003e019 100644
--- a/test/development/acceptance/__snapshots__/error-recovery.test.ts.snap
+++ b/test/development/acceptance/__snapshots__/error-recovery.test.ts.snap
@@ -11,3 +11,15 @@ exports[`ReactRefreshLogBox default syntax > runtime error 1`] = `
7 | export default function FunctionNamed() {
8 | return
"
`;
+
+exports[`ReactRefreshLogBox turbo syntax > runtime error 1`] = `
+"index.js (5:9) @ eval
+
+ 3 | setInterval(() => {
+ 4 | i++
+> 5 | throw Error('no ' + i)
+ | ^
+ 6 | }, 1000)
+ 7 | export default function FunctionNamed() {
+ 8 | return "
+`;
diff --git a/test/development/acceptance/error-recovery.test.ts b/test/development/acceptance/error-recovery.test.ts
index 0b9e4c61216a2..1aaf2cb034d1a 100644
--- a/test/development/acceptance/error-recovery.test.ts
+++ b/test/development/acceptance/error-recovery.test.ts
@@ -434,50 +434,81 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
await new Promise((resolve) => setTimeout(resolve, 1000))
expect(await session.hasRedbox()).toBe(true)
- expect(next.normalizeTestDirContent(await session.getRedboxSource()))
- .toMatchInlineSnapshot(`
- "./index.js
- Error:
- x Expected '}', got ''
- ,-[TEST_DIR/index.js:4:1]
- 4 | i++
- 5 | throw Error('no ' + i)
- 6 | }, 1000)
- 7 | export default function FunctionNamed() {
- : ^
- \`----
-
- Caused by:
- Syntax Error
-
- Import trace for requested module:
- ./index.js
- ./pages/index.js"
- `)
+ let redboxSource = next.normalizeTestDirContent(
+ await session.getRedboxSource()
+ )
+
+ if (isTurbopack) {
+ // TODO: Remove this branching once import traces are implemented in Turbopack
+ expect(redboxSource).toMatchInlineSnapshot(`
+ "./index.js:7:41
+ Parsing ecmascript source code failed
+ 5 | throw Error('no ' + i)
+ 6 | }, 1000)
+ > 7 | export default function FunctionNamed() {
+ | ^
+
+ Expected '}', got ''"
+ `)
+ } else {
+ expect(redboxSource).toMatchInlineSnapshot(`
+ "./index.js
+ Error:
+ x Expected '}', got ''
+ ,-[TEST_DIR/index.js:4:1]
+ 4 | i++
+ 5 | throw Error('no ' + i)
+ 6 | }, 1000)
+ 7 | export default function FunctionNamed() {
+ : ^
+ \`----
+
+ Caused by:
+ Syntax Error
+
+ Import trace for requested module:
+ ./index.js
+ ./pages/index.js"
+ `)
+ }
// Test that runtime error does not take over:
await new Promise((resolve) => setTimeout(resolve, 2000))
expect(await session.hasRedbox()).toBe(true)
- expect(next.normalizeTestDirContent(await session.getRedboxSource()))
- .toMatchInlineSnapshot(`
- "./index.js
- Error:
- x Expected '}', got ''
- ,-[TEST_DIR/index.js:4:1]
- 4 | i++
- 5 | throw Error('no ' + i)
- 6 | }, 1000)
- 7 | export default function FunctionNamed() {
- : ^
- \`----
-
- Caused by:
- Syntax Error
-
- Import trace for requested module:
- ./index.js
- ./pages/index.js"
- `)
+ redboxSource = next.normalizeTestDirContent(await session.getRedboxSource())
+ if (isTurbopack) {
+ // TODO: Remove this branching once import traces are implemented in Turbopack
+ expect(redboxSource).toMatchInlineSnapshot(`
+ "./index.js:7:41
+ Parsing ecmascript source code failed
+ 5 | throw Error('no ' + i)
+ 6 | }, 1000)
+ > 7 | export default function FunctionNamed() {
+ | ^
+
+ Expected '}', got ''"
+ `)
+ } else {
+ expect(redboxSource).toMatchInlineSnapshot(`
+ "./index.js
+ Error:
+ x Expected '}', got ''
+ ,-[TEST_DIR/index.js:4:1]
+ 4 | i++
+ 5 | throw Error('no ' + i)
+ 6 | }, 1000)
+ 7 | export default function FunctionNamed() {
+ : ^
+ \`----
+
+ Caused by:
+ Syntax Error
+
+ Import trace for requested module:
+ ./index.js
+ ./pages/index.js"
+ `)
+ }
await cleanup()
})