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

[test] Use new Redbox matchers in pages/ error-recovery test (#76348)

parent 49c26c7b
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`ReactRefreshLogBox default 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 <div />"
`;
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 <div />"
`;
...@@ -86,13 +86,7 @@ describe('non-root-project-monorepo', () => { ...@@ -86,13 +86,7 @@ describe('non-root-project-monorepo', () => {
if (stack === null) { if (stack === null) {
return null return null
} }
const isolatedPath = /file:\/\/.*\/next-install-[^/]+\//g return stack.join('\n')
const nonIsolatedPath =
/file:\/\/.*\/test\/e2e\/app-dir\/non-root-project-monorepo\//g
return stack
.join('\n')
.replaceAll(nonIsolatedPath, 'file://<full-path>/')
.replaceAll(isolatedPath, 'file://<full-path>/')
} }
it('should work on RSC', async () => { it('should work on RSC', async () => {
...@@ -134,8 +128,8 @@ describe('non-root-project-monorepo', () => { ...@@ -134,8 +128,8 @@ describe('non-root-project-monorepo', () => {
expect(normalizeStackTrace(await getRedboxCallStack(browser))) expect(normalizeStackTrace(await getRedboxCallStack(browser)))
.toMatchInlineSnapshot(` .toMatchInlineSnapshot(`
"eval app/separate-file.ts (1:11) "eval app/separate-file.ts (1:11)
<unknown> rsc)/./app/separate-file.ts (rsc://React/Server/file://<full-path>/apps/web/.next/server/app/source-maps-rsc/page.js?3 (63:1) <FIXME-file-protocol>
__webpack_require__ rsc:/Server/file://<full-path>/apps/web/.next/server/webpack-runtime.js (33:42) <FIXME-file-protocol>
innerArrowFunction app/source-maps-rsc/page.tsx (14:3) innerArrowFunction app/source-maps-rsc/page.tsx (14:3)
innerFunction app/source-maps-rsc/page.tsx (10:3) innerFunction app/source-maps-rsc/page.tsx (10:3)
Page app/source-maps-rsc/page.tsx (4:5)" Page app/source-maps-rsc/page.tsx (4:5)"
...@@ -177,10 +171,10 @@ describe('non-root-project-monorepo', () => { ...@@ -177,10 +171,10 @@ describe('non-root-project-monorepo', () => {
expect(normalizeStackTrace(await getRedboxCallStack(browser))) expect(normalizeStackTrace(await getRedboxCallStack(browser)))
.toMatchInlineSnapshot(` .toMatchInlineSnapshot(`
"eval app/separate-file.ts (1:7) "eval app/separate-file.ts (1:7)
./app/separate-file.ts file://<full-path>/apps/web/.next/static/chunks/app/source-maps-ssr/page.js (49:1) <FIXME-file-protocol>
options.factory file://<full-path>/apps/web/.next/static/chunks/webpack.js (700:31) <FIXME-file-protocol>
__webpack_require__ file://<full-path>/apps/web/.next/static/chunks/webpack.js (37:33) <FIXME-file-protocol>
fn file://<full-path>/apps/web/.next/static/chunks/webpack.js (357:21) <FIXME-file-protocol>
innerArrowFunction app/source-maps-ssr/page.tsx (16:3) innerArrowFunction app/source-maps-ssr/page.tsx (16:3)
innerFunction app/source-maps-ssr/page.tsx (12:3) innerFunction app/source-maps-ssr/page.tsx (12:3)
Page app/source-maps-ssr/page.tsx (6:5)" Page app/source-maps-ssr/page.tsx (6:5)"
...@@ -222,10 +216,10 @@ describe('non-root-project-monorepo', () => { ...@@ -222,10 +216,10 @@ describe('non-root-project-monorepo', () => {
expect(normalizeStackTrace(await getRedboxCallStack(browser))) expect(normalizeStackTrace(await getRedboxCallStack(browser)))
.toMatchInlineSnapshot(` .toMatchInlineSnapshot(`
"eval app/separate-file.ts (1:7) "eval app/separate-file.ts (1:7)
./app/separate-file.ts file://<full-path>/apps/web/.next/static/chunks/app/source-maps-client/page.js (49:1) <FIXME-file-protocol>
options.factory file://<full-path>/apps/web/.next/static/chunks/webpack.js (712:31) <FIXME-file-protocol>
__webpack_require__ file://<full-path>/apps/web/.next/static/chunks/webpack.js (37:33) <FIXME-file-protocol>
fn file://<full-path>/apps/web/.next/static/chunks/webpack.js (369:21) <FIXME-file-protocol>
innerArrowFunction app/source-maps-client/page.tsx (17:3) innerArrowFunction app/source-maps-client/page.tsx (17:3)
innerFunction app/source-maps-client/page.tsx (13:3) innerFunction app/source-maps-client/page.tsx (13:3)
effectCallback app/source-maps-client/page.tsx (7:5)" effectCallback app/source-maps-client/page.tsx (7:5)"
......
...@@ -1417,6 +1417,8 @@ export async function getRedboxCallStack( ...@@ -1417,6 +1417,8 @@ export async function getRedboxCallStack(
stack.push('<FIXME-internal-frame>') stack.push('<FIXME-internal-frame>')
} }
foundInternalFrame = true foundInternalFrame = true
} else if (frame.includes('file://')) {
stack.push('<FIXME-file-protocol>')
} else { } else {
stack.push(frame) stack.push(frame)
} }
......
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