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

Move ReactRefreshLogBox-builtins tests to inline snapshots (#57952)

This avoids separate snapshots for both Turbopack and Webpack, and correctly reflects that these fail.
parent 6f8c5803
...@@ -50,7 +50,16 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => { ...@@ -50,7 +50,16 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
` `
) )
expect(await session.hasRedbox(true)).toBe(true) expect(await session.hasRedbox(true)).toBe(true)
expect(await session.getRedboxSource()).toMatchSnapshot() expect(await session.getRedboxSource()).toMatchInlineSnapshot(`
"./node_modules/my-package/index.js (1:0)
Module not found: Can't resolve 'dns'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./index.js
./app/page.js"
`)
await cleanup() await cleanup()
}) })
...@@ -75,7 +84,19 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => { ...@@ -75,7 +84,19 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
expect(await session.hasRedbox(true)).toBe(true) expect(await session.hasRedbox(true)).toBe(true)
const source = await session.getRedboxSource() const source = await session.getRedboxSource()
expect(source).toMatchSnapshot() expect(source).toMatchInlineSnapshot(`
"./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>
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./app/page.js"
`)
await cleanup() await cleanup()
}) })
...@@ -101,7 +122,17 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => { ...@@ -101,7 +122,17 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
expect(await session.hasRedbox(true)).toBe(true) expect(await session.hasRedbox(true)).toBe(true)
const source = await session.getRedboxSource() const source = await session.getRedboxSource()
expect(source).toMatchSnapshot() expect(source).toMatchInlineSnapshot(`
"./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>
https://nextjs.org/docs/messages/module-not-found"
`)
await cleanup() await cleanup()
}) })
...@@ -125,7 +156,17 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => { ...@@ -125,7 +156,17 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
expect(await session.hasRedbox(true)).toBe(true) expect(await session.hasRedbox(true)).toBe(true)
const source = await session.getRedboxSource() const source = await session.getRedboxSource()
expect(source).toMatchSnapshot() expect(source).toMatchInlineSnapshot(`
"./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 | }
https://nextjs.org/docs/messages/module-not-found"
`)
await session.patch( await session.patch(
'app/page.js', 'app/page.js',
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
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 | <div>
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./app/page.js"
`;
exports[`ReactRefreshLogBox app default Module not found empty import trace 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>
https://nextjs.org/docs/messages/module-not-found"
`;
exports[`ReactRefreshLogBox app default Module not found missing global CSS 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 | }
https://nextjs.org/docs/messages/module-not-found"
`;
exports[`ReactRefreshLogBox app default Node.js builtins 1`] = `
"./node_modules/my-package/index.js (1:0)
Module not found: Can't resolve 'dns'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./index.js
./app/page.js"
`;
...@@ -45,7 +45,16 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => { ...@@ -45,7 +45,16 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
` `
) )
expect(await session.hasRedbox(true)).toBe(true) expect(await session.hasRedbox(true)).toBe(true)
expect(await session.getRedboxSource()).toMatchSnapshot() expect(await session.getRedboxSource()).toMatchInlineSnapshot(`
"./node_modules/my-package/index.js:1:0
Module not found: Can't resolve 'dns'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./index.js
./pages/index.js"
`)
await cleanup() await cleanup()
}) })
...@@ -71,7 +80,19 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => { ...@@ -71,7 +80,19 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
expect(await session.hasRedbox(true)).toBe(true) expect(await session.hasRedbox(true)).toBe(true)
const source = await session.getRedboxSource() const source = await session.getRedboxSource()
expect(source).toMatchSnapshot() expect(source).toMatchInlineSnapshot(`
"./index.js:1:0
Module not found: Can't resolve 'b'
> 1 | import Comp from 'b'
2 |
3 | export default function Oops() {
4 | return (
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./pages/index.js"
`)
await cleanup() await cleanup()
}) })
...@@ -97,7 +118,16 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => { ...@@ -97,7 +118,16 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
expect(await session.hasRedbox(true)).toBe(true) expect(await session.hasRedbox(true)).toBe(true)
const source = await session.getRedboxSource() const source = await session.getRedboxSource()
expect(source).toMatchSnapshot() expect(source).toMatchInlineSnapshot(`
"./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 (
https://nextjs.org/docs/messages/module-not-found"
`)
await cleanup() await cleanup()
}) })
...@@ -129,7 +159,16 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => { ...@@ -129,7 +159,16 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
expect(await session.hasRedbox(true)).toBe(true) expect(await session.hasRedbox(true)).toBe(true)
const source = await session.getRedboxSource() const source = await session.getRedboxSource()
expect(source).toMatchSnapshot() expect(source).toMatchInlineSnapshot(`
"./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} />
https://nextjs.org/docs/messages/module-not-found"
`)
await session.patch( await session.patch(
'pages/_app.js', 'pages/_app.js',
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
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 |
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: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} />
https://nextjs.org/docs/messages/module-not-found"
`;
exports[`ReactRefreshLogBox default Module not found 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 (
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./pages/index.js"
`;
exports[`ReactRefreshLogBox default Node.js builtins 1`] = `
"./node_modules/my-package/index.js:1:0
Module not found: Can't resolve 'dns'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./index.js
./pages/index.js"
`;
...@@ -857,21 +857,20 @@ ...@@ -857,21 +857,20 @@
"runtimeError": false "runtimeError": false
}, },
"test/development/acceptance-app/ReactRefreshLogBox-builtins.test.ts": { "test/development/acceptance-app/ReactRefreshLogBox-builtins.test.ts": {
"passed": [ "passed": [],
"failed": [
"ReactRefreshLogBox app turbo Module not found", "ReactRefreshLogBox app turbo Module not found",
"ReactRefreshLogBox app turbo Module not found empty import trace", "ReactRefreshLogBox app turbo Module not found empty import trace",
"ReactRefreshLogBox app turbo Module not found missing global CSS",
"ReactRefreshLogBox app turbo Node.js builtins" "ReactRefreshLogBox app turbo Node.js builtins"
], ],
"failed": [],
"pending": [ "pending": [
"ReactRefreshLogBox app default Module not found", "ReactRefreshLogBox app default Module not found",
"ReactRefreshLogBox app default Module not found empty import trace", "ReactRefreshLogBox app default Module not found empty import trace",
"ReactRefreshLogBox app default Module not found missing global CSS", "ReactRefreshLogBox app default Module not found missing global CSS",
"ReactRefreshLogBox app default Node.js builtins" "ReactRefreshLogBox app default Node.js builtins"
], ],
"flakey": [ "flakey": [],
"ReactRefreshLogBox app turbo Module not found missing global CSS"
],
"runtimeError": false "runtimeError": false
}, },
"test/development/acceptance-app/ReactRefreshLogBox-scss.test.ts": { "test/development/acceptance-app/ReactRefreshLogBox-scss.test.ts": {
...@@ -1193,12 +1192,11 @@ ...@@ -1193,12 +1192,11 @@
"runtimeError": false "runtimeError": false
}, },
"test/development/acceptance/ReactRefreshLogBox-builtins.test.ts": { "test/development/acceptance/ReactRefreshLogBox-builtins.test.ts": {
"passed": [ "passed": [],
"failed": [
"ReactRefreshLogBox turbo Module not found", "ReactRefreshLogBox turbo Module not found",
"ReactRefreshLogBox turbo Module not found (empty import trace)", "ReactRefreshLogBox turbo Module not found (empty import trace)",
"ReactRefreshLogBox turbo Node.js builtins" "ReactRefreshLogBox turbo Node.js builtins",
],
"failed": [
"ReactRefreshLogBox turbo Module not found (missing global CSS)" "ReactRefreshLogBox turbo Module not found (missing global CSS)"
], ],
"pending": [ "pending": [
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