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', () => {
`
)
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()
})
......@@ -75,7 +84,19 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
expect(await session.hasRedbox(true)).toBe(true)
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()
})
......@@ -101,7 +122,17 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
expect(await session.hasRedbox(true)).toBe(true)
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()
})
......@@ -125,7 +156,17 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
expect(await session.hasRedbox(true)).toBe(true)
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(
'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', () => {
`
)
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()
})
......@@ -71,7 +80,19 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
expect(await session.hasRedbox(true)).toBe(true)
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()
})
......@@ -97,7 +118,16 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
expect(await session.hasRedbox(true)).toBe(true)
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()
})
......@@ -110,7 +140,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
'pages/_app.js',
outdent`
import './non-existent.css'
export default function App({ Component, pageProps }) {
return <Component {...pageProps} />
}
......@@ -129,7 +159,16 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
expect(await session.hasRedbox(true)).toBe(true)
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(
'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 @@
"runtimeError": false
},
"test/development/acceptance-app/ReactRefreshLogBox-builtins.test.ts": {
"passed": [
"passed": [],
"failed": [
"ReactRefreshLogBox app turbo Module not found",
"ReactRefreshLogBox app turbo Module not found empty import trace",
"ReactRefreshLogBox app turbo Module not found missing global CSS",
"ReactRefreshLogBox app turbo Node.js builtins"
],
"failed": [],
"pending": [
"ReactRefreshLogBox app default Module not found",
"ReactRefreshLogBox app default Module not found empty import trace",
"ReactRefreshLogBox app default Module not found missing global CSS",
"ReactRefreshLogBox app default Node.js builtins"
],
"flakey": [
"ReactRefreshLogBox app turbo Module not found missing global CSS"
],
"flakey": [],
"runtimeError": false
},
"test/development/acceptance-app/ReactRefreshLogBox-scss.test.ts": {
......@@ -1193,12 +1192,11 @@
"runtimeError": false
},
"test/development/acceptance/ReactRefreshLogBox-builtins.test.ts": {
"passed": [
"passed": [],
"failed": [
"ReactRefreshLogBox turbo Module not found",
"ReactRefreshLogBox turbo Module not found (empty import trace)",
"ReactRefreshLogBox turbo Node.js builtins"
],
"failed": [
"ReactRefreshLogBox turbo Node.js builtins",
"ReactRefreshLogBox turbo Module not found (missing global CSS)"
],
"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