Unverified Commit afa34e93 authored by Sebastian "Sebbie" Silbermann's avatar Sebastian "Sebbie" Silbermann Committed by GitHub

[dev-overlay] Fix off-by-one column sourcemapping in Webpack (#76152)

parent 88601928
...@@ -76,7 +76,8 @@ async function getSourceFrame( ...@@ -76,7 +76,8 @@ async function getSourceFrame(
file: fileName, file: fileName,
methodName: '', methodName: '',
lineNumber: loc.start.line, lineNumber: loc.start.line,
column: loc.start.column, // loc is 0-based but columns in stack frames are 1-based.
column: (loc.start.column ?? 0) + 1,
}, },
}) })
......
...@@ -232,6 +232,9 @@ function findApplicableSourceMapPayload( ...@@ -232,6 +232,9 @@ function findApplicableSourceMapPayload(
} }
} }
/**
* @returns 1-based lines and 0-based columns
*/
async function nativeTraceSource( async function nativeTraceSource(
frame: TurbopackStackFrame frame: TurbopackStackFrame
): Promise<{ frame: IgnorableStackFrame; source: string | null } | undefined> { ): Promise<{ frame: IgnorableStackFrame; source: string | null } | undefined> {
...@@ -264,7 +267,8 @@ async function nativeTraceSource( ...@@ -264,7 +267,8 @@ async function nativeTraceSource(
try { try {
const originalPosition = consumer.originalPositionFor({ const originalPosition = consumer.originalPositionFor({
line: frame.line ?? 1, line: frame.line ?? 1,
column: frame.column ?? 1, // 0-based columns out requires 0-based columns in.
column: (frame.column ?? 1) - 1,
}) })
if (originalPosition.source === null) { if (originalPosition.source === null) {
......
...@@ -90,9 +90,12 @@ function getSourcePath(source: string) { ...@@ -90,9 +90,12 @@ function getSourcePath(source: string) {
return source.replace(/^(webpack:\/\/\/|webpack:\/\/|webpack:\/\/_N_E\/)/, '') return source.replace(/^(webpack:\/\/\/|webpack:\/\/|webpack:\/\/_N_E\/)/, '')
} }
/**
* @returns 1-based lines and 0-based columns
*/
async function findOriginalSourcePositionAndContent( async function findOriginalSourcePositionAndContent(
sourceMap: RawSourceMap, sourceMap: RawSourceMap,
position: { line: number; column: number | null } position: { lineNumber: number | null; column: number | null }
): Promise<SourceAttributes | null> { ): Promise<SourceAttributes | null> {
let consumer: BasicSourceMapConsumer let consumer: BasicSourceMapConsumer
try { try {
...@@ -106,8 +109,9 @@ async function findOriginalSourcePositionAndContent( ...@@ -106,8 +109,9 @@ async function findOriginalSourcePositionAndContent(
try { try {
const sourcePosition = consumer.originalPositionFor({ const sourcePosition = consumer.originalPositionFor({
line: position.line, line: position.lineNumber ?? 1,
column: position.column ?? 0, // 0-based columns out requires 0-based columns in.
column: (position.column ?? 1) - 1,
}) })
if (!sourcePosition.source) { if (!sourcePosition.source) {
...@@ -191,7 +195,6 @@ export async function createOriginalStackFrame({ ...@@ -191,7 +195,6 @@ export async function createOriginalStackFrame({
frame: StackFrame frame: StackFrame
errorMessage?: string errorMessage?: string
}): Promise<OriginalStackFrameResponse | null> { }): Promise<OriginalStackFrameResponse | null> {
const { lineNumber, column } = frame
const moduleNotFound = findModuleNotFoundFromError(errorMessage) const moduleNotFound = findModuleNotFoundFromError(errorMessage)
const result = await (() => { const result = await (() => {
if (moduleNotFound) { if (moduleNotFound) {
...@@ -205,11 +208,7 @@ export async function createOriginalStackFrame({ ...@@ -205,11 +208,7 @@ export async function createOriginalStackFrame({
source.compilation source.compilation
) )
} }
// This returns 1-based lines and 0-based columns return findOriginalSourcePositionAndContent(source.sourceMap, frame)
return findOriginalSourcePositionAndContent(source.sourceMap, {
line: lineNumber ?? 1,
column,
})
})() })()
if (!result) { if (!result) {
......
...@@ -41,8 +41,6 @@ describe('app-dir - capture-console-error-owner-stack', () => { ...@@ -41,8 +41,6 @@ describe('app-dir - capture-console-error-owner-stack', () => {
const result = await getRedboxResult(browser) const result = await getRedboxResult(browser)
// TODO(veil): Inconsistent cursor position for the "Page" frame
if (process.env.TURBOPACK) {
expect(result).toMatchInlineSnapshot(` expect(result).toMatchInlineSnapshot(`
{ {
"callStacks": "onClick "callStacks": "onClick
...@@ -65,30 +63,6 @@ describe('app-dir - capture-console-error-owner-stack', () => { ...@@ -65,30 +63,6 @@ describe('app-dir - capture-console-error-owner-stack', () => {
"title": "Console Error", "title": "Console Error",
} }
`) `)
} else {
expect(result).toMatchInlineSnapshot(`
{
"callStacks": "onClick
app/browser/event/page.js (7:17)
button
<anonymous> (0:0)
Page
app/browser/event/page.js (5:6)",
"count": 1,
"description": "trigger an console <error>",
"source": "app/browser/event/page.js (7:17) @ onClick
5 | <button
6 | onClick={() => {
> 7 | console.error('trigger an console <%s>', 'error')
| ^
8 | }}
9 | >
10 | click to error",
"title": "Console Error",
}
`)
}
}) })
it('should capture browser console error in render and dedupe if necessary', async () => { it('should capture browser console error in render and dedupe if necessary', async () => {
...@@ -227,7 +201,6 @@ describe('app-dir - capture-console-error-owner-stack', () => { ...@@ -227,7 +201,6 @@ describe('app-dir - capture-console-error-owner-stack', () => {
} }
`) `)
} else { } else {
if (process.env.TURBOPACK) {
expect(result).toMatchInlineSnapshot(` expect(result).toMatchInlineSnapshot(`
{ {
"callStacks": "Page "callStacks": "Page
...@@ -249,29 +222,6 @@ describe('app-dir - capture-console-error-owner-stack', () => { ...@@ -249,29 +222,6 @@ describe('app-dir - capture-console-error-owner-stack', () => {
"title": "Console Error", "title": "Console Error",
} }
`) `)
} else {
expect(result).toMatchInlineSnapshot(`
{
"callStacks": "Page
app/rsc/page.js (2:17)
JSON.parse
<anonymous> (0:0)
Page
<anonymous> (0:0)",
"count": 1,
"description": "[ Server ] Error: boom",
"source": "app/rsc/page.js (2:17) @ Page
1 | export default function Page() {
> 2 | console.error(new Error('boom'))
| ^
3 | return <p>rsc</p>
4 | }
5 |",
"title": "Console Error",
}
`)
}
} }
}) })
......
...@@ -6,7 +6,7 @@ import { ...@@ -6,7 +6,7 @@ import {
} from 'next-test-utils' } from 'next-test-utils'
describe('error-ignored-frames', () => { describe('error-ignored-frames', () => {
const { next } = nextTestSetup({ const { isTurbopack, next } = nextTestSetup({
files: __dirname, files: __dirname,
}) })
...@@ -30,7 +30,7 @@ describe('error-ignored-frames', () => { ...@@ -30,7 +30,7 @@ describe('error-ignored-frames', () => {
await toggleCollapseCallStackFrames(browser) await toggleCollapseCallStackFrames(browser)
const expendedStack = await getStackFramesContent(browser) const expendedStack = await getStackFramesContent(browser)
if (process.env.TURBOPACK) { if (isTurbopack) {
expect(expendedStack).toMatchInlineSnapshot(` expect(expendedStack).toMatchInlineSnapshot(`
"at Page (app/page.tsx (2:9)) "at Page (app/page.tsx (2:9))
at resolveErrorDev () at resolveErrorDev ()
...@@ -50,11 +50,11 @@ describe('error-ignored-frames', () => { ...@@ -50,11 +50,11 @@ describe('error-ignored-frames', () => {
at processFullStringRow () at processFullStringRow ()
at processFullBinaryRow () at processFullBinaryRow ()
at progress () at progress ()
at InnerLayoutRouter (../src/client/components/layout-router.tsx (408:6)) at InnerLayoutRouter (../src/client/components/layout-router.tsx (408:5))
at OuterLayoutRouter (../src/client/components/layout-router.tsx (607:20)) at OuterLayoutRouter (../src/client/components/layout-router.tsx (607:19))
at Router (../src/client/components/app-router.tsx (633:8)) at Router (../src/client/components/app-router.tsx (633:7))
at AppRouter (../src/client/components/app-router.tsx (679:8)) at AppRouter (../src/client/components/app-router.tsx (679:7))
at ServerRoot (../src/client/app-index.tsx (201:6))" at ServerRoot (../src/client/app-index.tsx (201:5))"
`) `)
} }
}) })
...@@ -71,7 +71,7 @@ describe('error-ignored-frames', () => { ...@@ -71,7 +71,7 @@ describe('error-ignored-frames', () => {
await toggleCollapseCallStackFrames(browser) await toggleCollapseCallStackFrames(browser)
const expendedStack = await getStackFramesContent(browser) const expendedStack = await getStackFramesContent(browser)
if (process.env.TURBOPACK) { if (isTurbopack) {
expect(expendedStack).toMatchInlineSnapshot(` expect(expendedStack).toMatchInlineSnapshot(`
"at Page (app/client/page.tsx (4:9)) "at Page (app/client/page.tsx (4:9))
at ClientPageRoot () at ClientPageRoot ()
...@@ -82,10 +82,10 @@ describe('error-ignored-frames', () => { ...@@ -82,10 +82,10 @@ describe('error-ignored-frames', () => {
} else { } else {
expect(expendedStack).toMatchInlineSnapshot(` expect(expendedStack).toMatchInlineSnapshot(`
"at Page (app/client/page.tsx (4:9)) "at Page (app/client/page.tsx (4:9))
at ClientPageRoot (../src/client/components/client-page.tsx (60:13)) at ClientPageRoot (../src/client/components/client-page.tsx (60:12))
at Router (../src/client/components/app-router.tsx (633:8)) at Router (../src/client/components/app-router.tsx (633:7))
at AppRouter (../src/client/components/app-router.tsx (679:8)) at AppRouter (../src/client/components/app-router.tsx (679:7))
at ServerRoot (../src/client/app-index.tsx (201:6))" at ServerRoot (../src/client/app-index.tsx (201:5))"
`) `)
} }
}) })
...@@ -95,7 +95,7 @@ describe('error-ignored-frames', () => { ...@@ -95,7 +95,7 @@ describe('error-ignored-frames', () => {
await assertHasRedbox(browser) await assertHasRedbox(browser)
const defaultStack = await getStackFramesContent(browser) const defaultStack = await getStackFramesContent(browser)
if (process.env.TURBOPACK) { if (isTurbopack) {
expect(defaultStack).toMatchInlineSnapshot(` expect(defaultStack).toMatchInlineSnapshot(`
"at <unknown> (app/interleaved/page.tsx (7:11)) "at <unknown> (app/interleaved/page.tsx (7:11))
at Page (app/interleaved/page.tsx (6:35))" at Page (app/interleaved/page.tsx (6:35))"
...@@ -103,18 +103,18 @@ describe('error-ignored-frames', () => { ...@@ -103,18 +103,18 @@ describe('error-ignored-frames', () => {
} else { } else {
expect(defaultStack).toMatchInlineSnapshot(` expect(defaultStack).toMatchInlineSnapshot(`
"at eval (app/interleaved/page.tsx (7:11)) "at eval (app/interleaved/page.tsx (7:11))
at Page (app/interleaved/page.tsx (6:37))" at Page (app/interleaved/page.tsx (6:36))"
`) `)
} }
await toggleCollapseCallStackFrames(browser) await toggleCollapseCallStackFrames(browser)
const expendedStack = await getStackFramesContent(browser) const expendedStack = await getStackFramesContent(browser)
if (process.env.TURBOPACK) { if (isTurbopack) {
expect(expendedStack).toMatchInlineSnapshot(` expect(expendedStack).toMatchInlineSnapshot(`
"at <unknown> (app/interleaved/page.tsx (7:11)) "at <unknown> (app/interleaved/page.tsx (7:11))
at invokeCallback ()
at Page (app/interleaved/page.tsx (6:35)) at Page (app/interleaved/page.tsx (6:35))
at invokeCallback ()
at ClientPageRoot () at ClientPageRoot ()
at Router () at Router ()
at AppRouter () at AppRouter ()
...@@ -124,11 +124,11 @@ describe('error-ignored-frames', () => { ...@@ -124,11 +124,11 @@ describe('error-ignored-frames', () => {
expect(expendedStack).toMatchInlineSnapshot(` expect(expendedStack).toMatchInlineSnapshot(`
"at eval (app/interleaved/page.tsx (7:11)) "at eval (app/interleaved/page.tsx (7:11))
at invokeCallback (node_modules/interleave/index.js (2:1)) at invokeCallback (node_modules/interleave/index.js (2:1))
at Page (app/interleaved/page.tsx (6:37)) at Page (app/interleaved/page.tsx (6:36))
at ClientPageRoot (../src/client/components/client-page.tsx (60:13)) at ClientPageRoot (../src/client/components/client-page.tsx (60:12))
at Router (../src/client/components/app-router.tsx (633:8)) at Router (../src/client/components/app-router.tsx (633:7))
at AppRouter (../src/client/components/app-router.tsx (679:8)) at AppRouter (../src/client/components/app-router.tsx (679:7))
at ServerRoot (../src/client/app-index.tsx (201:6))" at ServerRoot (../src/client/app-index.tsx (201:5))"
`) `)
} }
}) })
...@@ -145,7 +145,7 @@ describe('error-ignored-frames', () => { ...@@ -145,7 +145,7 @@ describe('error-ignored-frames', () => {
await toggleCollapseCallStackFrames(browser) await toggleCollapseCallStackFrames(browser)
const expendedStack = await getStackFramesContent(browser) const expendedStack = await getStackFramesContent(browser)
if (process.env.TURBOPACK) { if (isTurbopack) {
expect(expendedStack).toMatchInlineSnapshot(` expect(expendedStack).toMatchInlineSnapshot(`
"at Page (pages/pages.tsx (2:9)) "at Page (pages/pages.tsx (2:9))
at react-stack-bottom-frame () at react-stack-bottom-frame ()
......
...@@ -17,7 +17,6 @@ describe('app-dir - owner-stack-invalid-element-type', () => { ...@@ -17,7 +17,6 @@ describe('app-dir - owner-stack-invalid-element-type', () => {
const source = await getRedboxSource(browser) const source = await getRedboxSource(browser)
const stackFramesContent = await getStackFramesContent(browser) const stackFramesContent = await getStackFramesContent(browser)
if (process.env.TURBOPACK) {
expect(stackFramesContent).toMatchInlineSnapshot(` expect(stackFramesContent).toMatchInlineSnapshot(`
"at BrowserOnly (app/browser/browser-only.js (8:7)) "at BrowserOnly (app/browser/browser-only.js (8:7))
at Inner (app/browser/page.js (11:10)) at Inner (app/browser/page.js (11:10))
...@@ -34,24 +33,6 @@ describe('app-dir - owner-stack-invalid-element-type', () => { ...@@ -34,24 +33,6 @@ describe('app-dir - owner-stack-invalid-element-type', () => {
10 | ) 10 | )
11 | }" 11 | }"
`) `)
} else {
expect(stackFramesContent).toMatchInlineSnapshot(`
"at BrowserOnly (app/browser/browser-only.js (8:8))
at Inner (app/browser/page.js (11:11))
at Page (app/browser/page.js (15:11))"
`)
expect(source).toMatchInlineSnapshot(`
"app/browser/browser-only.js (8:8) @ BrowserOnly
6 | return (
7 | <div>
> 8 | <Foo />
| ^
9 | </div>
10 | )
11 | }"
`)
}
}) })
it('should catch invalid element from a rsc component', async () => { it('should catch invalid element from a rsc component', async () => {
...@@ -61,29 +42,12 @@ describe('app-dir - owner-stack-invalid-element-type', () => { ...@@ -61,29 +42,12 @@ describe('app-dir - owner-stack-invalid-element-type', () => {
const stackFramesContent = await getStackFramesContent(browser) const stackFramesContent = await getStackFramesContent(browser)
const source = await getRedboxSource(browser) const source = await getRedboxSource(browser)
if (process.env.TURBOPACK) {
expect(stackFramesContent).toMatchInlineSnapshot(`
"at Inner (app/rsc/page.js (5:11))
at Page (app/rsc/page.js (11:8))"
`)
expect(source).toMatchInlineSnapshot(`
"app/rsc/page.js (5:11) @ Inner
3 | // Intermediate component for testing owner stack
4 | function Inner() {
> 5 | return <Foo />
| ^
6 | }
7 |
8 | export default function Page() {"
`)
} else {
expect(stackFramesContent).toMatchInlineSnapshot(` expect(stackFramesContent).toMatchInlineSnapshot(`
"at Inner (app/rsc/page.js (5:11)) "at Inner (app/rsc/page.js (5:10))
at Page (app/rsc/page.js (11:8))" at Page (app/rsc/page.js (11:7))"
`) `)
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"app/rsc/page.js (5:11) @ Inner "app/rsc/page.js (5:10) @ Inner
3 | // Intermediate component for testing owner stack 3 | // Intermediate component for testing owner stack
4 | function Inner() { 4 | function Inner() {
...@@ -93,7 +57,6 @@ describe('app-dir - owner-stack-invalid-element-type', () => { ...@@ -93,7 +57,6 @@ describe('app-dir - owner-stack-invalid-element-type', () => {
7 | 7 |
8 | export default function Page() {" 8 | export default function Page() {"
`) `)
}
}) })
it('should catch invalid element from on ssr client component', async () => { it('should catch invalid element from on ssr client component', async () => {
...@@ -103,7 +66,6 @@ describe('app-dir - owner-stack-invalid-element-type', () => { ...@@ -103,7 +66,6 @@ describe('app-dir - owner-stack-invalid-element-type', () => {
const stackFramesContent = await getStackFramesContent(browser) const stackFramesContent = await getStackFramesContent(browser)
const source = await getRedboxSource(browser) const source = await getRedboxSource(browser)
if (process.env.TURBOPACK) {
expect(stackFramesContent).toMatchInlineSnapshot(` expect(stackFramesContent).toMatchInlineSnapshot(`
"at Inner (app/ssr/page.js (7:10)) "at Inner (app/ssr/page.js (7:10))
at Page (app/ssr/page.js (13:7))" at Page (app/ssr/page.js (13:7))"
...@@ -119,22 +81,5 @@ describe('app-dir - owner-stack-invalid-element-type', () => { ...@@ -119,22 +81,5 @@ describe('app-dir - owner-stack-invalid-element-type', () => {
9 | 9 |
10 | export default function Page() {" 10 | export default function Page() {"
`) `)
} else {
expect(stackFramesContent).toMatchInlineSnapshot(`
"at Inner (app/ssr/page.js (7:11))
at Page (app/ssr/page.js (13:8))"
`)
expect(source).toMatchInlineSnapshot(`
"app/ssr/page.js (7:11) @ Inner
5 | // Intermediate component for testing owner stack
6 | function Inner() {
> 7 | return <Foo />
| ^
8 | }
9 |
10 | export default function Page() {"
`)
}
}) })
}) })
...@@ -6,7 +6,7 @@ import { ...@@ -6,7 +6,7 @@ import {
} from 'next-test-utils' } from 'next-test-utils'
describe('app-dir - owner-stack-react-missing-key-prop', () => { describe('app-dir - owner-stack-react-missing-key-prop', () => {
const { next } = nextTestSetup({ const { isTurbopack, next } = nextTestSetup({
files: __dirname, files: __dirname,
}) })
...@@ -17,14 +17,14 @@ describe('app-dir - owner-stack-react-missing-key-prop', () => { ...@@ -17,14 +17,14 @@ describe('app-dir - owner-stack-react-missing-key-prop', () => {
const stackFramesContent = await getStackFramesContent(browser) const stackFramesContent = await getStackFramesContent(browser)
const source = await getRedboxSource(browser) const source = await getRedboxSource(browser)
if (process.env.TURBOPACK) { if (isTurbopack) {
expect(stackFramesContent).toMatchInlineSnapshot(` expect(stackFramesContent).toMatchInlineSnapshot(`
"at span () "at span ()
at <anonymous> (app/rsc/page.tsx (7:10)) at <anonymous> (app/rsc/page.tsx (7:9))
at Page (app/rsc/page.tsx (6:13))" at Page (app/rsc/page.tsx (6:13))"
`) `)
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"app/rsc/page.tsx (7:10) @ <anonymous> "app/rsc/page.tsx (7:9) @ <anonymous>
5 | <div> 5 | <div>
6 | {list.map((item, index) => ( 6 | {list.map((item, index) => (
...@@ -37,11 +37,11 @@ describe('app-dir - owner-stack-react-missing-key-prop', () => { ...@@ -37,11 +37,11 @@ describe('app-dir - owner-stack-react-missing-key-prop', () => {
} else { } else {
expect(stackFramesContent).toMatchInlineSnapshot(` expect(stackFramesContent).toMatchInlineSnapshot(`
"at span () "at span ()
at eval (app/rsc/page.tsx (7:10)) at eval (app/rsc/page.tsx (7:9))
at Page (app/rsc/page.tsx (6:13))" at Page (app/rsc/page.tsx (6:13))"
`) `)
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"app/rsc/page.tsx (7:10) @ eval "app/rsc/page.tsx (7:9) @ eval
5 | <div> 5 | <div>
6 | {list.map((item, index) => ( 6 | {list.map((item, index) => (
...@@ -60,7 +60,7 @@ describe('app-dir - owner-stack-react-missing-key-prop', () => { ...@@ -60,7 +60,7 @@ describe('app-dir - owner-stack-react-missing-key-prop', () => {
const stackFramesContent = await getStackFramesContent(browser) const stackFramesContent = await getStackFramesContent(browser)
const source = await getRedboxSource(browser) const source = await getRedboxSource(browser)
if (process.env.TURBOPACK) { if (isTurbopack) {
expect(stackFramesContent).toMatchInlineSnapshot(` expect(stackFramesContent).toMatchInlineSnapshot(`
"at p () "at p ()
at <unknown> (app/ssr/page.tsx (9:9)) at <unknown> (app/ssr/page.tsx (9:9))
...@@ -81,12 +81,12 @@ describe('app-dir - owner-stack-react-missing-key-prop', () => { ...@@ -81,12 +81,12 @@ describe('app-dir - owner-stack-react-missing-key-prop', () => {
} else { } else {
expect(stackFramesContent).toMatchInlineSnapshot(` expect(stackFramesContent).toMatchInlineSnapshot(`
"at p () "at p ()
at eval (app/ssr/page.tsx (9:10)) at eval (app/ssr/page.tsx (9:9))
at Array.map () at Array.map ()
at Page (app/ssr/page.tsx (8:13))" at Page (app/ssr/page.tsx (8:13))"
`) `)
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"app/ssr/page.tsx (9:10) @ eval "app/ssr/page.tsx (9:9) @ eval
7 | <div> 7 | <div>
8 | {list.map((item, index) => ( 8 | {list.map((item, index) => (
......
...@@ -47,7 +47,7 @@ async function getStackFramesContent(browser) { ...@@ -47,7 +47,7 @@ async function getStackFramesContent(browser) {
} }
describe('app-dir - owner-stack', () => { describe('app-dir - owner-stack', () => {
const { isTurbopack, next } = nextTestSetup({ const { next } = nextTestSetup({
files: __dirname, files: __dirname,
}) })
...@@ -168,7 +168,7 @@ describe('app-dir - owner-stack', () => { ...@@ -168,7 +168,7 @@ describe('app-dir - owner-stack', () => {
await openRedbox(browser) await openRedbox(browser)
const stackFramesContent = await getStackFramesContent(browser) const stackFramesContent = await getStackFramesContent(browser)
if (isTurbopack) {
expect(stackFramesContent).toMatchInlineSnapshot(` expect(stackFramesContent).toMatchInlineSnapshot(`
"at useThrowError (app/browser/caught/page.js (34:11)) "at useThrowError (app/browser/caught/page.js (34:11))
at useErrorHook (app/browser/caught/page.js (39:3)) at useErrorHook (app/browser/caught/page.js (39:3))
...@@ -176,15 +176,6 @@ describe('app-dir - owner-stack', () => { ...@@ -176,15 +176,6 @@ describe('app-dir - owner-stack', () => {
at Inner (app/browser/caught/page.js (23:7)) at Inner (app/browser/caught/page.js (23:7))
at Page (app/browser/caught/page.js (43:10))" at Page (app/browser/caught/page.js (43:10))"
`) `)
} else {
expect(stackFramesContent).toMatchInlineSnapshot(`
"at useThrowError (app/browser/caught/page.js (34:11))
at useErrorHook (app/browser/caught/page.js (39:3))
at Thrower (app/browser/caught/page.js (29:3))
at Inner (app/browser/caught/page.js (23:8))
at Page (app/browser/caught/page.js (43:11))"
`)
}
expect(normalizeStackTrace(errorLog)).toMatchInlineSnapshot(` expect(normalizeStackTrace(errorLog)).toMatchInlineSnapshot(`
"%o "%o
......
...@@ -6,7 +6,7 @@ import { ...@@ -6,7 +6,7 @@ import {
} from 'next-test-utils' } from 'next-test-utils'
describe('server-navigation-error', () => { describe('server-navigation-error', () => {
const { next } = nextTestSetup({ const { isTurbopack, next } = nextTestSetup({
files: __dirname, files: __dirname,
}) })
...@@ -18,7 +18,7 @@ describe('server-navigation-error', () => { ...@@ -18,7 +18,7 @@ describe('server-navigation-error', () => {
`Next.js navigation API is not allowed to be used in Pages Router.` `Next.js navigation API is not allowed to be used in Pages Router.`
) )
const source = await getRedboxSource(browser) const source = await getRedboxSource(browser)
if (process.env.TURBOPACK) { if (isTurbopack) {
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"pages/pages/redirect.tsx (4:10) @ Page "pages/pages/redirect.tsx (4:10) @ Page
...@@ -31,7 +31,7 @@ describe('server-navigation-error', () => { ...@@ -31,7 +31,7 @@ describe('server-navigation-error', () => {
`) `)
} else { } else {
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"pages/pages/redirect.tsx (4:12) @ Page "pages/pages/redirect.tsx (4:11) @ Page
2 | 2 |
3 | export default function Page() { 3 | export default function Page() {
...@@ -50,7 +50,7 @@ describe('server-navigation-error', () => { ...@@ -50,7 +50,7 @@ describe('server-navigation-error', () => {
`Next.js navigation API is not allowed to be used in Pages Router.` `Next.js navigation API is not allowed to be used in Pages Router.`
) )
const source = await getRedboxSource(browser) const source = await getRedboxSource(browser)
if (process.env.TURBOPACK) { if (isTurbopack) {
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"pages/pages/not-found.tsx (4:10) @ Page "pages/pages/not-found.tsx (4:10) @ Page
...@@ -86,7 +86,7 @@ describe('server-navigation-error', () => { ...@@ -86,7 +86,7 @@ describe('server-navigation-error', () => {
`Next.js navigation API is not allowed to be used in Middleware.` `Next.js navigation API is not allowed to be used in Middleware.`
) )
const source = await getRedboxSource(browser) const source = await getRedboxSource(browser)
if (process.env.TURBOPACK) { if (isTurbopack) {
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"middleware.ts (8:12) @ middleware "middleware.ts (8:12) @ middleware
...@@ -100,7 +100,7 @@ describe('server-navigation-error', () => { ...@@ -100,7 +100,7 @@ describe('server-navigation-error', () => {
`) `)
} else { } else {
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"middleware.ts (8:14) @ middleware "middleware.ts (8:13) @ middleware
6 | notFound() 6 | notFound()
7 | } else if (req.nextUrl.pathname === '/middleware/redirect') { 7 | } else if (req.nextUrl.pathname === '/middleware/redirect') {
...@@ -121,7 +121,7 @@ describe('server-navigation-error', () => { ...@@ -121,7 +121,7 @@ describe('server-navigation-error', () => {
) )
const source = await getRedboxSource(browser) const source = await getRedboxSource(browser)
if (process.env.TURBOPACK) { if (isTurbopack) {
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"middleware.ts (6:12) @ middleware "middleware.ts (6:12) @ middleware
......
...@@ -56,7 +56,7 @@ describe('use-cache-standalone-search-params', () => { ...@@ -56,7 +56,7 @@ describe('use-cache-standalone-search-params', () => {
at Page (file:/`) at Page (file:/`)
} else { } else {
expect(errorSource).toMatchInlineSnapshot(` expect(errorSource).toMatchInlineSnapshot(`
"app/search-params-used/page.tsx (8:18) @ Page "app/search-params-used/page.tsx (8:17) @ Page
6 | searchParams: Promise<{ [key: string]: string | string[] | undefined }> 6 | searchParams: Promise<{ [key: string]: string | string[] | undefined }>
7 | }) { 7 | }) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment