Unverified Commit a32d654c authored by Will Binns-Smith's avatar Will Binns-Smith Committed by GitHub

Revert "Turbopack: convert between locations correctly (#61477)" (#61733)

This reverts commit b19585f7.


Closes PACK-2420
parent 252d9cf4
......@@ -791,9 +791,7 @@ pub fn project_update_info_subscribe(
#[derive(Debug)]
#[napi(object)]
pub struct StackFrame {
// 1-indexed, unlike source map tokens
pub column: Option<u32>,
// 1-indexed, unlike source map tokens
pub file: String,
pub is_server: bool,
pub line: u32,
......@@ -878,10 +876,7 @@ pub async fn project_trace_source(
};
let token = map
.lookup_token(
(frame.line as usize).saturating_sub(1),
(frame.column.unwrap_or(1) as usize).saturating_sub(1),
)
.lookup_token(frame.line as usize, frame.column.unwrap_or(0) as usize)
.await?
.clone_value()
.context("Unable to trace token from sourcemap")?;
......@@ -898,8 +893,8 @@ pub async fn project_trace_source(
Ok(Some(StackFrame {
file: source_file.to_string(),
method_name: token.name,
line: token.original_line as u32 + 1,
column: Some(token.original_column as u32 + 1),
line: token.original_line as u32,
column: Some(token.original_column as u32),
is_server: frame.is_server,
}))
})
......
......@@ -507,18 +507,8 @@ export interface Issue {
content?: string
}
range?: {
start: {
// 0-indexed
line: number
// 0-indexed
column: number
}
end: {
// 0-indexed
line: number
// 0-indexed
column: number
}
start: { line: number; column: number }
end: { line: number; column: number }
}
}
documentationLink: string
......
......@@ -339,7 +339,7 @@ async function startWatcher(opts: SetupOpts) {
if (source && source.range) {
const { start } = source.range
message = `${formattedFilePath}:${start.line + 1}:${
start.column + 1
start.column
}\n${formattedTitle}`
} else if (formattedFilePath) {
message = `${formattedFilePath}\n${formattedTitle}`
......
......@@ -16,9 +16,7 @@ interface Project {
}
interface TurbopackStackFrame {
// 1-based
column: number | null
// 1-based
file: string
isServer: boolean
line: number
......@@ -89,7 +87,7 @@ export async function createOriginalStackFrame(
{
start: {
line: traced.frame.lineNumber,
column: traced.frame.column ?? 1,
column: traced.frame.column ?? 0,
},
},
{ forceColor: true }
......
......@@ -194,7 +194,6 @@ export async function createOriginalStackFrame({
return moduleNotFoundResult
}
// This returns 1-based lines and 0-based columns
return await findOriginalSourcePositionAndContent(source, {
line,
column,
......@@ -226,7 +225,7 @@ export async function createOriginalStackFrame({
? path.relative(rootDirectory, filePath)
: sourcePosition.source,
lineNumber: sourcePosition.line,
column: (sourcePosition.column ?? 0) + 1,
column: sourcePosition.column,
methodName:
sourcePosition.name ||
// default is not a valid identifier in JS so webpack uses a custom variable when it's an unnamed default export
......@@ -246,7 +245,7 @@ export async function createOriginalStackFrame({
{
start: {
line: sourcePosition.line,
column: (sourcePosition.column ?? 0) + 1,
column: sourcePosition.column ?? 0,
},
},
{ forceColor: true }
......
......@@ -52,7 +52,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
expect(await session.hasRedbox()).toBe(true)
if (process.env.TURBOPACK) {
expect(await session.getRedboxSource()).toMatchInlineSnapshot(`
"./node_modules/my-package/index.js:1:13
"./node_modules/my-package/index.js:1:12
Module not found: Can't resolve 'dns'
> 1 | const dns = require('dns')
| ^^^^^^^^^^^^^^
......@@ -62,7 +62,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
`)
} else {
expect(await session.getRedboxSource()).toMatchInlineSnapshot(`
"./node_modules/my-package/index.js:1:13
"./node_modules/my-package/index.js:1:12
Module not found: Can't resolve 'dns'
https://nextjs.org/docs/messages/module-not-found
......@@ -98,7 +98,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
const source = await session.getRedboxSource()
if (process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(`
"./index.js:1:1
"./index.js:1:0
Module not found: Can't resolve 'b'
> 1 | import Comp from 'b'
| ^^^^^^^^^^^^^^^^^^^^
......@@ -110,10 +110,9 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
`)
} else {
expect(source).toMatchInlineSnapshot(`
"./index.js:1:1
"./index.js:1:0
Module not found: Can't resolve 'b'
> 1 | import Comp from 'b'
| ^
2 | export default function Oops() {
3 | return (
4 | <div>
......@@ -151,7 +150,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
const source = await session.getRedboxSource()
if (process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(`
"./app/page.js:2:1
"./app/page.js:2:0
Module not found: Can't resolve 'b'
1 | 'use client'
> 2 | import Comp from 'b'
......@@ -164,11 +163,10 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
`)
} else {
expect(source).toMatchInlineSnapshot(`
"./app/page.js:2:1
"./app/page.js:2:0
Module not found: Can't resolve 'b'
1 | 'use client'
> 2 | import Comp from 'b'
| ^
3 | export default function Oops() {
4 | return (
5 | <div>
......@@ -201,7 +199,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
const source = await session.getRedboxSource()
if (process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(`
"./app/page.js:2:1
"./app/page.js:2:0
Module not found: Can't resolve './non-existent.css'
1 | 'use client'
> 2 | import './non-existent.css'
......@@ -214,11 +212,10 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
`)
} else {
expect(source).toMatchInlineSnapshot(`
"./app/page.js:2:1
"./app/page.js:2:0
Module not found: Can't resolve './non-existent.css'
1 | 'use client'
> 2 | import './non-existent.css'
| ^
3 | export default function Page(props) {
4 | return <p>index page</p>
5 | }
......
......@@ -222,7 +222,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
const source = next.normalizeTestDirContent(await session.getRedboxSource())
if (IS_TURBOPACK) {
expect(source).toMatchInlineSnapshot(`
"./index.js:7:1
"./index.js:7:0
Parsing ecmascript source code failed
5 | div
6 | )
......@@ -357,7 +357,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
expect(await session.hasRedbox()).toBe(true)
const source = await session.getRedboxSource()
expect(source).toMatch(
IS_TURBOPACK ? './index.module.css:1:9' : './index.module.css:1:1'
IS_TURBOPACK ? './index.module.css:1:8' : './index.module.css:1:1'
)
if (!IS_TURBOPACK) {
expect(source).toMatch('Syntax error: ')
......
......@@ -286,7 +286,7 @@ describe('ReactRefreshRegression app', () => {
const source = await session.getRedboxSource()
expect(source.split(/\r?\n/g).slice(2).join('\n')).toMatchInlineSnapshot(`
"> 1 | export default function () { throw new Error('boom'); }
| ^"
| ^"
`)
await cleanup()
......@@ -305,7 +305,7 @@ describe('ReactRefreshRegression app', () => {
const source = await session.getRedboxSource()
expect(source.split(/\r?\n/g).slice(2).join('\n')).toMatchInlineSnapshot(`
"> 1 | export default function Page() { throw new Error('boom'); }
| ^"
| ^"
`)
await cleanup()
......@@ -326,10 +326,10 @@ describe('ReactRefreshRegression app', () => {
const source = await session.getRedboxSource()
expect(source.split(/\r?\n/g).slice(2).join('\n')).toMatchInlineSnapshot(`
" 1 | 'use client'
> 2 | export default function Page() { throw new Error('boom'); }
| ^"
`)
" 1 | 'use client'
> 2 | export default function Page() { throw new Error('boom'); }
| ^"
`)
await cleanup()
})
......
......@@ -11,10 +11,9 @@ Import trace for requested module:
`;
exports[`ReactRefreshLogBox app default Import trace when module not found in layout 1`] = `
"./app/module.js:1:1
"./app/module.js:1:0
Module not found: Can't resolve 'non-existing-module'
> 1 | import "non-existing-module"
| ^
https://nextjs.org/docs/messages/module-not-found
......@@ -23,31 +22,31 @@ Import trace for requested module:
`;
exports[`ReactRefreshLogBox app default Should not show __webpack_exports__ when exporting anonymous arrow function 1`] = `
"index.js (3:11) @ default
"index.js (3:10) @ default
1 | export default () => {
2 | if (typeof window !== 'undefined') {
> 3 | throw new Error('test')
| ^
| ^
4 | }
5 |
6 | return null"
`;
exports[`ReactRefreshLogBox app default boundaries 1`] = `
"FunctionDefault.js (1:51) @ FunctionDefault
"FunctionDefault.js (1:50) @ FunctionDefault
> 1 | export default function FunctionDefault() { throw new Error('no'); }
| ^"
| ^"
`;
exports[`ReactRefreshLogBox app default conversion to class component (1) 1`] = `
"Child.js (4:11) @ ClickCount.render
"Child.js (4:10) @ ClickCount.render
2 | export default class ClickCount extends Component {
3 | render() {
> 4 | throw new Error()
| ^
| ^
5 | }
6 | }"
`;
......@@ -77,31 +76,31 @@ exports[`ReactRefreshLogBox app default logbox: anchors links in error messages
exports[`ReactRefreshLogBox app default logbox: anchors links in error messages 9`] = `"http://example.com/"`;
exports[`ReactRefreshLogBox app default module init error not shown 1`] = `
"index.js (3:7) @ eval
"index.js (3:6) @ eval
1 | // top offset for snapshot
2 | import * as React from 'react';
> 3 | throw new Error('no')
| ^
| ^
4 | class ClassDefault extends React.Component {
5 | render() {
6 | return <h1>Default Export</h1>;"
`;
exports[`ReactRefreshLogBox app default should strip whitespace correctly with newline 1`] = `
"index.js (7:15) @ onClick
"index.js (7:14) @ onClick
5 |
6 | <a onClick={() => {
> 7 | throw new Error('idk')
| ^
| ^
8 | }}>
9 | click me
10 | </a>"
`;
exports[`ReactRefreshLogBox app turbo Can't resolve @import in CSS file 1`] = `
"./app/styles1.css:1:1
"./app/styles1.css:1:0
Parsing css source code failed
> 1 | @import "./styles2.css"
| ^^^^^^^^^^^^^^^^^^^^^^^
......@@ -110,7 +109,7 @@ Unexpected end of file, but expected ';' or '{'"
`;
exports[`ReactRefreshLogBox app turbo Import trace when module not found in layout 1`] = `
"./app/module.js:1:1
"./app/module.js:1:0
Module not found: Can't resolve 'non-existing-module'
> 1 | import "non-existing-module"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
......@@ -119,22 +118,21 @@ https://nextjs.org/docs/messages/module-not-found"
`;
exports[`ReactRefreshLogBox app turbo Should not show __webpack_exports__ when exporting anonymous arrow function 1`] = `
"index.js (3:11) @ {default export}
"index.js (3:2) @ {default export}
1 | export default () => {
2 | if (typeof window !== 'undefined') {
> 3 | throw new Error('test')
| ^
| ^
4 | }
5 |
6 | return null"
`;
exports[`ReactRefreshLogBox app turbo boundaries 1`] = `
"FunctionDefault.js (1:51) @ FunctionDefault
"FunctionDefault.js (0:67) @ FunctionDefault
> 1 | export default function FunctionDefault() { throw new Error('no'); }
| ^"
1 | export default function FunctionDefault() { throw new Error('no'); }"
`;
exports[`ReactRefreshLogBox app turbo logbox: anchors links in error messages 1`] = `"Error: end http://nextjs.org"`;
......@@ -154,24 +152,24 @@ exports[`ReactRefreshLogBox app turbo logbox: anchors links in error messages 8`
exports[`ReactRefreshLogBox app turbo logbox: anchors links in error messages 9`] = `"http://example.com/"`;
exports[`ReactRefreshLogBox app turbo module init error not shown 1`] = `
"index.js (3:7) @ <unknown>
"index.js (3:6) @ <unknown>
1 | // top offset for snapshot
2 | import * as React from 'react';
> 3 | throw new Error('no')
| ^
| ^
4 | class ClassDefault extends React.Component {
5 | render() {
6 | return <h1>Default Export</h1>;"
`;
exports[`ReactRefreshLogBox app turbo should strip whitespace correctly with newline 1`] = `
"index.js (7:15) @ onClick
"index.js (7:6) @ onClick
5 |
6 | <a onClick={() => {
> 7 | throw new Error('idk')
| ^
| ^
8 | }}>
9 | click me
10 | </a>"
......
......@@ -6,7 +6,7 @@ import path from 'path'
import { outdent } from 'outdent'
describe.each(['default', 'turbo'])('Error recovery app %s', () => {
const { next } = nextTestSetup({
const { next, isTurbopack } = nextTestSetup({
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
dependencies: {
react: 'latest',
......@@ -144,17 +144,31 @@ describe.each(['default', 'turbo'])('Error recovery app %s', () => {
await session.waitForAndOpenRuntimeError()
expect(await session.getRedboxSource()).toMatchInlineSnapshot(`
"index.js (7:11) @ eval
5 | const increment = useCallback(() => {
6 | setCount(c => c + 1)
> 7 | throw new Error('oops')
| ^
8 | }, [setCount])
9 | return (
10 | <main>"
`)
if (isTurbopack) {
expect(await session.getRedboxSource()).toMatchInlineSnapshot(`
"index.js (7:5) @ eval
5 | const increment = useCallback(() => {
6 | setCount(c => c + 1)
> 7 | throw new Error('oops')
| ^
8 | }, [setCount])
9 | return (
10 | <main>"
`)
} else {
expect(await session.getRedboxSource()).toMatchInlineSnapshot(`
"index.js (7:10) @ eval
5 | const increment = useCallback(() => {
6 | setCount(c => c + 1)
> 7 | throw new Error('oops')
| ^
8 | }, [setCount])
9 | return (
10 | <main>"
`)
}
await session.patch(
'index.js',
......
......@@ -48,7 +48,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
expect(await session.getRedboxSource()).toMatchInlineSnapshot(
process.env.TURBOPACK
? `
"./node_modules/my-package/index.js:1:13
"./node_modules/my-package/index.js:1:12
Module not found: Can't resolve 'dns'
> 1 | const dns = require('dns')
| ^^^^^^^^^^^^^^
......@@ -57,7 +57,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
https://nextjs.org/docs/messages/module-not-found"
`
: `
"./node_modules/my-package/index.js:1:1
"./node_modules/my-package/index.js:1:0
Module not found: Can't resolve 'dns'
https://nextjs.org/docs/messages/module-not-found
......@@ -94,7 +94,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
const source = await session.getRedboxSource()
if (process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(`
"./index.js:1:1
"./index.js:1:0
Module not found: Can't resolve 'b'
> 1 | import Comp from 'b'
| ^^^^^^^^^^^^^^^^^^^^
......@@ -106,10 +106,9 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
`)
} else {
expect(source).toMatchInlineSnapshot(`
"./index.js:1:1
"./index.js:1:0
Module not found: Can't resolve 'b'
> 1 | import Comp from 'b'
| ^
2 |
3 | export default function Oops() {
4 | return (
......@@ -147,7 +146,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
const source = await session.getRedboxSource()
if (process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(`
"./pages/index.js:1:1
"./pages/index.js:1:0
Module not found: Can't resolve 'b'
> 1 | import Comp from 'b'
| ^^^^^^^^^^^^^^^^^^^^
......@@ -159,10 +158,9 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
`)
} else {
expect(source).toMatchInlineSnapshot(`
"./pages/index.js:1:1
"./pages/index.js:1:0
Module not found: Can't resolve 'b'
> 1 | import Comp from 'b'
| ^
2 |
3 | export default function Oops() {
4 | return (
......@@ -203,7 +201,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
const source = await session.getRedboxSource()
if (process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(`
"./pages/_app.js:1:1
"./pages/_app.js:1:0
Module not found: Can't resolve './non-existent.css'
> 1 | import './non-existent.css'
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
......@@ -215,10 +213,9 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
`)
} else {
expect(source).toMatchInlineSnapshot(`
"./pages/_app.js:1:1
"./pages/_app.js:1:0
Module not found: Can't resolve './non-existent.css'
> 1 | import './non-existent.css'
| ^
2 |
3 | export default function App({ Component, pageProps }) {
4 | return <Component {...pageProps} />
......
......@@ -211,7 +211,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
const source = next.normalizeTestDirContent(await session.getRedboxSource())
if (process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(`
"./index.js:7:1
"./index.js:7:0
Parsing ecmascript source code failed
5 | div
6 | )
......@@ -347,7 +347,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
const source = await session.getRedboxSource()
expect(source).toMatch(
process.env.TURBOPACK
? './index.module.css:1:9'
? './index.module.css:1:8'
: './index.module.css:1:1'
)
if (!process.env.TURBOPACK) {
......
......@@ -288,7 +288,7 @@ describe('ReactRefreshRegression', () => {
const source = await session.getRedboxSource()
expect(source.split(/\r?\n/g).slice(2).join('\n')).toMatchInlineSnapshot(`
"> 1 | export default function () { throw new Error('boom'); }
| ^"
| ^"
`)
await cleanup()
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`ReactRefreshLogBox default boundaries 1`] = `
"FunctionDefault.js (1:51) @ FunctionDefault
"FunctionDefault.js (1:50) @ FunctionDefault
> 1 | export default function FunctionDefault() { throw new Error('no'); }
| ^"
| ^"
`;
exports[`ReactRefreshLogBox default conversion to class component (1) 1`] = `
"Child.js (4:11) @ ClickCount.render
"Child.js (4:10) @ ClickCount.render
2 | export default class ClickCount extends Component {
3 | render() {
> 4 | throw new Error()
| ^
| ^
5 | }
6 | }"
`;
......@@ -47,24 +47,24 @@ exports[`ReactRefreshLogBox default logbox: anchors links in error messages 11`]
exports[`ReactRefreshLogBox default logbox: anchors links in error messages 12`] = `"http://example.com/"`;
exports[`ReactRefreshLogBox default module init error not shown 1`] = `
"index.js (3:7) @ eval
"index.js (3:6) @ eval
1 | // top offset for snapshot
2 | import * as React from 'react';
> 3 | throw new Error('no')
| ^
| ^
4 | class ClassDefault extends React.Component {
5 | render() {
6 | return <h1>Default Export</h1>;"
`;
exports[`ReactRefreshLogBox default should strip whitespace correctly with newline 1`] = `
"index.js (8:27) @ onClick
"index.js (8:26) @ onClick
6 |
7 | <a onClick={() => {
> 8 | throw new Error('idk')
| ^
| ^
9 | }}>
10 | click me
11 | </a>"
......@@ -93,24 +93,24 @@ exports[`ReactRefreshLogBox turbo logbox: anchors links in error messages 11`] =
exports[`ReactRefreshLogBox turbo logbox: anchors links in error messages 12`] = `"http://example.com/"`;
exports[`ReactRefreshLogBox turbo module init error not shown 1`] = `
"index.js (3:7) @ <unknown>
"index.js (3:6) @ <unknown>
1 | // top offset for snapshot
2 | import * as React from 'react';
> 3 | throw new Error('no')
| ^
| ^
4 | class ClassDefault extends React.Component {
5 | render() {
6 | return <h1>Default Export</h1>;"
`;
exports[`ReactRefreshLogBox turbo should strip whitespace correctly with newline 1`] = `
"index.js (8:27) @ onClick
"index.js (8:18) @ onClick
6 |
7 | <a onClick={() => {
> 8 | throw new Error('idk')
| ^
| ^
9 | }}>
10 | click me
11 | </a>"
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`ReactRefreshLogBox default syntax > runtime error 1`] = `
"index.js (5:9) @ Error
"index.js (5:8) @ Error
3 | setInterval(() => {
4 | i++
> 5 | throw Error('no ' + i)
| ^
| ^
6 | }, 1000)
7 | export default function FunctionNamed() {
8 | return <div />"
......
......@@ -107,24 +107,24 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
expect(await session.hasRedbox()).toBe(true)
if (isTurbopack) {
expect(await session.getRedboxSource()).toMatchInlineSnapshot(`
"index.js (7:11) @ <unknown>
"index.js (7:5) @ <unknown>
5 | const increment = useCallback(() => {
6 | setCount(c => c + 1)
> 7 | throw new Error('oops')
| ^
| ^
8 | }, [setCount])
9 | return (
10 | <main>"
`)
} else {
expect(await session.getRedboxSource()).toMatchInlineSnapshot(`
"index.js (7:11) @ eval
"index.js (7:10) @ eval
5 | const increment = useCallback(() => {
6 | setCount(c => c + 1)
> 7 | throw new Error('oops')
| ^
| ^
8 | }, [setCount])
9 | return (
10 | <main>"
......
......@@ -524,7 +524,7 @@ describe.each([[''], ['/docs']])(
`)
} else if (basePath === '' && process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(`
"./pages/hmr/about2.js:7:1
"./pages/hmr/about2.js:7:0
Parsing ecmascript source code failed
5 | div
6 | )
......@@ -562,7 +562,7 @@ describe.each([[''], ['/docs']])(
`)
} else if (basePath === '/docs' && process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(`
"./pages/hmr/about2.js:7:1
"./pages/hmr/about2.js:7:0
Parsing ecmascript source code failed
5 | div
6 | )
......
......@@ -1385,7 +1385,7 @@ createNextDescribe(
const text = await getRedboxSource(browser)
expect(text).toMatch(/An Expected error occurred/)
expect(text).toMatch(
/pages[\\/]error-inside-browser-page\.js \(5:13\)/
/pages[\\/]error-inside-browser-page\.js \(5:12\)/
)
} finally {
if (browser) {
......@@ -1404,7 +1404,7 @@ createNextDescribe(
expect(await hasRedbox(browser)).toBe(true)
const text = await getRedboxSource(browser)
expect(text).toMatch(/An Expected error occurred/)
expect(text).toMatch(/error-in-the-browser-global-scope\.js \(2:9\)/)
expect(text).toMatch(/error-in-the-browser-global-scope\.js \(2:8\)/)
} finally {
if (browser) {
await browser.close()
......
......@@ -40,12 +40,12 @@ const appDir = join(__dirname, '../')
// TODO: add win32 snapshot
} else {
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
"pages/index.js (5:11) @ eval
"pages/index.js (5:10) @ eval
3 | export default function Index(props) {
4 | useEffect(() => {
> 5 | throw new Error('this should render')
| ^
| ^
6 | }, [])
7 | return <div>Index Page</div>
8 | }"
......
......@@ -206,7 +206,7 @@ describe('server-side dev errors', () => {
const err = stderr.slice(stderrIdx)
return err.includes('pages/uncaught-rejection.js') &&
err.includes('7:20') &&
(err.includes('7:19') || err.includes('7:5')) &&
err.includes('getServerSideProps') &&
err.includes('catch this rejection')
? 'success'
......@@ -222,7 +222,7 @@ describe('server-side dev errors', () => {
const cleanStderr = stripAnsi(stderr.slice(stderrIdx))
return cleanStderr.includes('pages/uncaught-empty-rejection.js') &&
cleanStderr.includes('7:20') &&
(cleanStderr.includes('7:19') || cleanStderr.includes('7:5')) &&
cleanStderr.includes('getServerSideProps') &&
cleanStderr.includes('new Error()')
? 'success'
......@@ -238,7 +238,7 @@ describe('server-side dev errors', () => {
const err = stderr.slice(stderrIdx)
return err.includes('pages/uncaught-exception.js') &&
err.includes('7:11') &&
(err.includes('7:10') || err.includes('7:5')) &&
err.includes('getServerSideProps') &&
err.includes('catch this exception')
? 'success'
......@@ -254,7 +254,7 @@ describe('server-side dev errors', () => {
const cleanStderr = stripAnsi(stderr.slice(stderrIdx))
return cleanStderr.includes('pages/uncaught-empty-exception.js') &&
cleanStderr.includes('7:11') &&
(cleanStderr.includes('7:10') || cleanStderr.includes('7:5')) &&
cleanStderr.includes('getServerSideProps') &&
cleanStderr.includes('new Error()')
? 'success'
......
......@@ -990,11 +990,11 @@
},
"test/development/acceptance-app/ReactRefreshRegression.test.ts": {
"passed": [
"ReactRefreshRegression app can fast refresh a page with static generation",
"ReactRefreshRegression app shows an overlay for server-side error in client component"
"ReactRefreshRegression app can fast refresh a page with static generation"
],
"failed": [
"ReactRefreshRegression app shows an overlay for anonymous function server-side error",
"ReactRefreshRegression app shows an overlay for server-side error in client component",
"ReactRefreshRegression app shows an overlay for server-side error in server component"
],
"pending": [
......@@ -1336,10 +1336,11 @@
"ReactRefreshRegression can fast refresh a page with config",
"ReactRefreshRegression can fast refresh a page with getServerSideProps",
"ReactRefreshRegression can fast refresh a page with getStaticProps",
"ReactRefreshRegression shows an overlay for a server-side error",
"ReactRefreshRegression styled-components hydration mismatch"
],
"failed": [],
"failed": [
"ReactRefreshRegression shows an overlay for a server-side error"
],
"pending": [
"ReactRefreshRegression Turbopack skipped tests custom loader (mdx) should have Fast Refresh enabled"
],
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