diff --git a/test/development/acceptance-app/ReactRefreshLogBox.test.ts b/test/development/acceptance-app/ReactRefreshLogBox.test.ts index f295750b7e69b..ba71baa42f42f 100644 --- a/test/development/acceptance-app/ReactRefreshLogBox.test.ts +++ b/test/development/acceptance-app/ReactRefreshLogBox.test.ts @@ -224,21 +224,20 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => { "./index.js Error: x Unexpected token. Did you mean \`{'}'}\` or \`}\`? - ,-[TEST_DIR/index.js:5:1] - 5 |

lol

- 6 | div - 7 | ) - 8 | } - : ^ - 9 | + ,-[TEST_DIR/index.js:4:1] + 4 |

lol

+ 5 | div + 6 | ) + 7 | } + : ^ \`---- x Unexpected eof - ,-[TEST_DIR/index.js:6:1] - 6 | div - 7 | ) - 8 | } - 9 | + ,-[TEST_DIR/index.js:4:1] + 4 |

lol

+ 5 | div + 6 | ) + 7 | } \`---- Caused by: diff --git a/test/development/acceptance-app/__snapshots__/ReactRefreshLogBox-builtins.test.ts.snap b/test/development/acceptance-app/__snapshots__/ReactRefreshLogBox-builtins.test.ts.snap index 5cf9d246fb057..ce10b2ebf4a8b 100644 --- a/test/development/acceptance-app/__snapshots__/ReactRefreshLogBox-builtins.test.ts.snap +++ b/test/development/acceptance-app/__snapshots__/ReactRefreshLogBox-builtins.test.ts.snap @@ -4,9 +4,9 @@ exports[`ReactRefreshLogBox app default Module not found 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 |
+ 2 | export default function Oops() { + 3 | return ( + 4 |
https://nextjs.org/docs/messages/module-not-found @@ -15,33 +15,31 @@ Import trace for requested module: `; exports[`ReactRefreshLogBox app default Module not found empty import trace 1`] = ` -"./app/page.js (2:6) +"./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 |
+> 2 | import Comp from 'b' + 3 | export default function Oops() { + 4 | return ( + 5 |
https://nextjs.org/docs/messages/module-not-found" `; exports[`ReactRefreshLogBox app default Module not found missing global CSS 1`] = ` -"./app/page.js:2:10 +"./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

index page

- 5 | } +> 2 | import './non-existent.css' + 3 | export default function Page(props) { + 4 | return

index page

+ 5 | } https://nextjs.org/docs/messages/module-not-found" `; exports[`ReactRefreshLogBox app default Node.js builtins 1`] = ` -"./node_modules/my-package/index.js (2:0) +"./node_modules/my-package/index.js (1:0) Module not found: Can't resolve 'dns' https://nextjs.org/docs/messages/module-not-found diff --git a/test/development/acceptance-app/__snapshots__/ReactRefreshLogBox.test.ts.snap b/test/development/acceptance-app/__snapshots__/ReactRefreshLogBox.test.ts.snap index 7734151a090b5..48b1e8f6b495d 100644 --- a/test/development/acceptance-app/__snapshots__/ReactRefreshLogBox.test.ts.snap +++ b/test/development/acceptance-app/__snapshots__/ReactRefreshLogBox.test.ts.snap @@ -22,15 +22,15 @@ Import trace for requested module: `; exports[`ReactRefreshLogBox app default Should not show __webpack_exports__ when exporting anonymous arrow function 1`] = ` -"index.js (4:16) @ default - - 2 | export default () => { - 3 | if (typeof window !== 'undefined') { -> 4 | throw new Error('test') - | ^ - 5 | } - 6 | - 7 | return null" +"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`] = ` @@ -41,15 +41,14 @@ exports[`ReactRefreshLogBox app default boundaries 1`] = ` `; exports[`ReactRefreshLogBox app default conversion to class component (1) 1`] = ` -"Child.js (5:18) @ ClickCount.render - - 3 | export default class ClickCount extends Component { - 4 | render() { -> 5 | throw new Error() - | ^ - 6 | } - 7 | } - 8 | " +"Child.js (4:10) @ ClickCount.render + + 2 | export default class ClickCount extends Component { + 3 | render() { +> 4 | throw new Error() + | ^ + 5 | } + 6 | }" `; exports[`ReactRefreshLogBox app default css syntax errors 1`] = ` @@ -77,25 +76,25 @@ 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 (4:14) @ eval - - 2 | // top offset for snapshot - 3 | import * as React from 'react'; -> 4 | throw new Error('no') - | ^ - 5 | class ClassDefault extends React.Component { - 6 | render() { - 7 | return

Default Export

;" +"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

Default Export

;" `; exports[`ReactRefreshLogBox app default should strip whitespace correctly with newline 1`] = ` -"index.js (9:34) @ onClick +"index.js (8:26) @ onClick - 7 | - 8 | { -> 9 | throw new Error('idk') + 6 | + 7 | { +> 8 | throw new Error('idk') | ^ - 10 | }}> - 11 | click me - 12 | " + 9 | }}> + 10 | click me + 11 | " `; diff --git a/test/development/acceptance-app/error-recovery.test.ts b/test/development/acceptance-app/error-recovery.test.ts index 2263ca437d526..5315ae453c2bf 100644 --- a/test/development/acceptance-app/error-recovery.test.ts +++ b/test/development/acceptance-app/error-recovery.test.ts @@ -144,15 +144,15 @@ describe.each(['default', 'turbo'])('Error recovery app %s', () => { await session.waitForAndOpenRuntimeError() expect(await session.getRedboxSource()).toMatchInlineSnapshot(` - "index.js (8:22) @ eval + "index.js (7:10) @ eval - 6 | const increment = useCallback(() => { - 7 | setCount(c => c + 1) - > 8 | throw new Error('oops') + 5 | const increment = useCallback(() => { + 6 | setCount(c => c + 1) + > 7 | throw new Error('oops') | ^ - 9 | }, [setCount]) - 10 | return ( - 11 |
" + 8 | }, [setCount]) + 9 | return ( + 10 |
" `) await session.patch( diff --git a/test/development/acceptance/ReactRefreshLogBox-app-doc.test.ts b/test/development/acceptance/ReactRefreshLogBox-app-doc.test.ts index b65e031473365..163bdf84ebf41 100644 --- a/test/development/acceptance/ReactRefreshLogBox-app-doc.test.ts +++ b/test/development/acceptance/ReactRefreshLogBox-app-doc.test.ts @@ -98,24 +98,20 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => { Error: x Expression expected ,-[TEST_DIR/pages/_app.js:1:1] - 1 | - 2 | function MyApp({ Component, pageProps }) { - 3 | return <; - : ^ - 4 | } - 5 | export default MyApp - 6 | + 1 | function MyApp({ Component, pageProps }) { + 2 | return <; + : ^ + 3 | } + 4 | export default MyApp \`---- x Expression expected ,-[TEST_DIR/pages/_app.js:1:1] - 1 | - 2 | function MyApp({ Component, pageProps }) { - 3 | return <; - : ^^^^^^^^^ - 4 | } - 5 | export default MyApp - 6 | + 1 | function MyApp({ Component, pageProps }) { + 2 | return <; + : ^^^^^^^^^ + 3 | } + 4 | export default MyApp \`---- Caused by: @@ -178,14 +174,13 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => { Error: x Unexpected token \`{\`. Expected identifier, string literal, numeric literal or [ for the computed key ,-[TEST_DIR/pages/_document.js:1:1] - 1 | - 2 | import Document, { Html, Head, Main, NextScript } from 'next/document' - 3 | - 4 | class MyDocument extends Document {{ - : ^ - 5 | static async getInitialProps(ctx) { - 6 | const initialProps = await Document.getInitialProps(ctx) - 7 | return { ...initialProps } + 1 | import Document, { Html, Head, Main, NextScript } from 'next/document' + 2 | + 3 | class MyDocument extends Document {{ + : ^ + 4 | static async getInitialProps(ctx) { + 5 | const initialProps = await Document.getInitialProps(ctx) + 6 | return { ...initialProps } \`---- Caused by: diff --git a/test/development/acceptance/ReactRefreshLogBox.test.ts b/test/development/acceptance/ReactRefreshLogBox.test.ts index 7c3d0df7dbe64..2b1290edaed06 100644 --- a/test/development/acceptance/ReactRefreshLogBox.test.ts +++ b/test/development/acceptance/ReactRefreshLogBox.test.ts @@ -215,21 +215,20 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => { "./index.js Error: x Unexpected token. Did you mean \`{'}'}\` or \`}\`? - ,-[TEST_DIR/index.js:5:1] - 5 |

lol

- 6 | div - 7 | ) - 8 | } - : ^ - 9 | + ,-[TEST_DIR/index.js:4:1] + 4 |

lol

+ 5 | div + 6 | ) + 7 | } + : ^ \`---- x Unexpected eof - ,-[TEST_DIR/index.js:6:1] - 6 | div - 7 | ) - 8 | } - 9 | + ,-[TEST_DIR/index.js:4:1] + 4 |

lol

+ 5 | div + 6 | ) + 7 | } \`---- Caused by: diff --git a/test/development/acceptance/__snapshots__/ReactRefreshLogBox-builtins.test.ts.snap b/test/development/acceptance/__snapshots__/ReactRefreshLogBox-builtins.test.ts.snap index 61b51fea30877..d22b4a1d2f676 100644 --- a/test/development/acceptance/__snapshots__/ReactRefreshLogBox-builtins.test.ts.snap +++ b/test/development/acceptance/__snapshots__/ReactRefreshLogBox-builtins.test.ts.snap @@ -4,22 +4,20 @@ exports[`ReactRefreshLogBox default Module not found (empty import trace) 1`] = "./pages/index.js:1:0 Module not found: Can't resolve 'b' > 1 | import Comp from 'b' - 2 | export default function Oops() { - 3 | return ( - 4 |
+ 2 | + 3 | export default function Oops() { + 4 | return ( https://nextjs.org/docs/messages/module-not-found" `; exports[`ReactRefreshLogBox default Module not found (missing global CSS) 1`] = ` -"./pages/_app.js:2:8 +"./pages/_app.js:1:0 Module not found: Can't resolve './non-existent.css' - 1 | -> 2 | import './non-existent.css' - | ^ - 3 | - 4 | export default function App({ Component, pageProps }) { - 5 | return +> 1 | import './non-existent.css' + 2 | + 3 | export default function App({ Component, pageProps }) { + 4 | return https://nextjs.org/docs/messages/module-not-found" `; @@ -28,9 +26,9 @@ exports[`ReactRefreshLogBox default Module not found 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 |
+ 2 | + 3 | export default function Oops() { + 4 | return ( https://nextjs.org/docs/messages/module-not-found @@ -39,7 +37,7 @@ Import trace for requested module: `; exports[`ReactRefreshLogBox default Node.js builtins 1`] = ` -"./node_modules/my-package/index.js:2:0 +"./node_modules/my-package/index.js:1:0 Module not found: Can't resolve 'dns' https://nextjs.org/docs/messages/module-not-found diff --git a/test/development/acceptance/__snapshots__/ReactRefreshLogBox.test.ts.snap b/test/development/acceptance/__snapshots__/ReactRefreshLogBox.test.ts.snap index 8a0214330075c..f603c73653803 100644 --- a/test/development/acceptance/__snapshots__/ReactRefreshLogBox.test.ts.snap +++ b/test/development/acceptance/__snapshots__/ReactRefreshLogBox.test.ts.snap @@ -8,15 +8,14 @@ exports[`ReactRefreshLogBox default boundaries 1`] = ` `; exports[`ReactRefreshLogBox default conversion to class component (1) 1`] = ` -"Child.js (5:18) @ ClickCount.render - - 3 | export default class ClickCount extends Component { - 4 | render() { -> 5 | throw new Error() - | ^ - 6 | } - 7 | } - 8 | " +"Child.js (4:10) @ ClickCount.render + + 2 | export default class ClickCount extends Component { + 3 | render() { +> 4 | throw new Error() + | ^ + 5 | } + 6 | }" `; exports[`ReactRefreshLogBox default css syntax errors 1`] = ` @@ -48,25 +47,25 @@ 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 (4:14) @ eval - - 2 | // top offset for snapshot - 3 | import * as React from 'react'; -> 4 | throw new Error('no') - | ^ - 5 | class ClassDefault extends React.Component { - 6 | render() { - 7 | return

Default Export

;" +"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

Default Export

;" `; exports[`ReactRefreshLogBox default should strip whitespace correctly with newline 1`] = ` -"index.js (9:34) @ onClick +"index.js (8:26) @ onClick - 7 | - 8 | { -> 9 | throw new Error('idk') + 6 | + 7 | { +> 8 | throw new Error('idk') | ^ - 10 | }}> - 11 | click me - 12 | " + 9 | }}> + 10 | click me + 11 | " `; diff --git a/test/development/acceptance/__snapshots__/error-recovery.test.ts.snap b/test/development/acceptance/__snapshots__/error-recovery.test.ts.snap index 69a69c4eb82fa..373d7f774d7a3 100644 --- a/test/development/acceptance/__snapshots__/error-recovery.test.ts.snap +++ b/test/development/acceptance/__snapshots__/error-recovery.test.ts.snap @@ -1,13 +1,13 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`ReactRefreshLogBox default syntax > runtime error 1`] = ` -"index.js (6:16) @ Error +"index.js (5:8) @ Error - 4 | setInterval(() => { - 5 | i++ -> 6 | throw Error('no ' + i) - | ^ - 7 | }, 1000) - 8 | export default function FunctionNamed() { - 9 | return
" + 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 226fdd49884d4..b1f7f78b03bc2 100644 --- a/test/development/acceptance/error-recovery.test.ts +++ b/test/development/acceptance/error-recovery.test.ts @@ -106,16 +106,16 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => { expect(await session.hasRedbox(true)).toBe(true) expect(await session.getRedboxSource()).toMatchInlineSnapshot(` - "index.js (8:18) @ eval - - 6 | const increment = useCallback(() => { - 7 | setCount(c => c + 1) - > 8 | throw new Error('oops') - | ^ - 9 | }, [setCount]) - 10 | return ( - 11 |
" - `) + "index.js (7:10) @ eval + + 5 | const increment = useCallback(() => { + 6 | setCount(c => c + 1) + > 7 | throw new Error('oops') + | ^ + 8 | }, [setCount]) + 9 | return ( + 10 |
" + `) await session.patch( 'index.js', @@ -428,12 +428,12 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => { "./index.js Error: x Expected '}', got '' - ,-[TEST_DIR/index.js:5:1] - 5 | i++ - 6 | throw Error('no ' + i) - 7 | }, 1000) - 8 | export default function FunctionNamed() { - : ^ + ,-[TEST_DIR/index.js:4:1] + 4 | i++ + 5 | throw Error('no ' + i) + 6 | }, 1000) + 7 | export default function FunctionNamed() { + : ^ \`---- Caused by: @@ -455,12 +455,12 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => { "./index.js Error: x Expected '}', got '' - ,-[TEST_DIR/index.js:5:1] - 5 | i++ - 6 | throw Error('no ' + i) - 7 | }, 1000) - 8 | export default function FunctionNamed() { - : ^ + ,-[TEST_DIR/index.js:4:1] + 4 | i++ + 5 | throw Error('no ' + i) + 6 | }, 1000) + 7 | export default function FunctionNamed() { + : ^ \`---- Caused by: diff --git a/test/development/acceptance/server-component-compiler-errors-in-pages.test.ts b/test/development/acceptance/server-component-compiler-errors-in-pages.test.ts index fc90a93527f06..2f3f3b34d5f39 100644 --- a/test/development/acceptance/server-component-compiler-errors-in-pages.test.ts +++ b/test/development/acceptance/server-component-compiler-errors-in-pages.test.ts @@ -64,12 +64,11 @@ describe('Error Overlay for server components compiler errors in pages', () => { You're importing a component that needs next/headers. That only works in a Server Component which is not supported in the pages/ directory. Read more: https://nextjs.org/docs/getting-started/react-essentials#server-components ,-[TEST_DIR/components/Comp.js:1:1] - 1 | - 2 | import { cookies } from 'next/headers' - : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - 3 | - 4 | export default function Page() { - 5 | return

hello world

+ 1 | import { cookies } from 'next/headers' + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 2 | + 3 | export default function Page() { + 4 | return

hello world

\`---- Import trace for requested module: @@ -110,12 +109,11 @@ describe('Error Overlay for server components compiler errors in pages', () => { You're importing a component that needs server-only. That only works in a Server Component which is not supported in the pages/ directory. Read more: https://nextjs.org/docs/getting-started/react-essentials#server-components ,-[TEST_DIR/components/Comp.js:1:1] - 1 | - 2 | import 'server-only' - : ^^^^^^^^^^^^^^^^^^^^ - 3 | - 4 | export default function Page() { - 5 | return 'hello world' + 1 | import 'server-only' + : ^^^^^^^^^^^^^^^^^^^^ + 2 | + 3 | export default function Page() { + 4 | return 'hello world' \`---- Import trace for requested module: