Unverified Commit 09d21d6e authored by Hannes Bornö's avatar Hannes Bornö Committed by GitHub

Move error overlay recovery tests to new file (#46965)

Move error overlay recovery tests in `ReactRefreshLogBox.test.ts` to a
new file. This is already done for the app router tests, but this does
it for the old router as well. Makes `ReactRefreshLogBox.test.ts` faster
to run.
parent 1e7f4a58
...@@ -47,44 +47,6 @@ exports[`ReactRefreshLogBox default logbox: anchors links in error messages 11`] ...@@ -47,44 +47,6 @@ 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 logbox: anchors links in error messages 12`] = `"http://example.com/"`;
exports[`ReactRefreshLogBox default logbox: can recover from a component error 1`] = `
"child.js (4:16) @ Child
2 | // hello
3 | export default function Child() {
> 4 | throw new Error('oops')
| ^
5 | }
6 | "
`;
exports[`ReactRefreshLogBox default logbox: can recover from a event handler error 1`] = `
"index.js (8:18) @ eval
6 | const increment = useCallback(() => {
7 | setCount(c => c + 1)
> 8 | throw new Error('oops')
| ^
9 | }, [setCount])
10 | return (
11 | <main>"
`;
exports[`ReactRefreshLogBox default logbox: can recover from a syntax error without losing state 1`] = `
"./index.js
Error:
x Unexpected eof
,----
1 | export default () => <div/
\`----
Caused by:
Syntax Error
Import trace for requested module:
./index.js"
`;
exports[`ReactRefreshLogBox default module init error not shown 1`] = ` exports[`ReactRefreshLogBox default module init error not shown 1`] = `
"index.js (4:14) @ eval "index.js (4:14) @ eval
...@@ -97,18 +59,6 @@ exports[`ReactRefreshLogBox default module init error not shown 1`] = ` ...@@ -97,18 +59,6 @@ exports[`ReactRefreshLogBox default module init error not shown 1`] = `
7 | return <h1>Default Export</h1>;" 7 | return <h1>Default Export</h1>;"
`; `;
exports[`ReactRefreshLogBox default render error not shown right after syntax error 1`] = `
"index.js (6:18) @ ClassDefault.render
4 | class ClassDefault extends React.Component {
5 | render() {
> 6 | throw new Error('nooo');
| ^
7 | return <h1>Default Export</h1>;
8 | }
9 | }"
`;
exports[`ReactRefreshLogBox default should strip whitespace correctly with newline 1`] = ` exports[`ReactRefreshLogBox default should strip whitespace correctly with newline 1`] = `
"index.js (9:34) @ onClick "index.js (9:34) @ onClick
...@@ -121,67 +71,6 @@ exports[`ReactRefreshLogBox default should strip whitespace correctly with newli ...@@ -121,67 +71,6 @@ exports[`ReactRefreshLogBox default should strip whitespace correctly with newli
12 | </a>" 12 | </a>"
`; `;
exports[`ReactRefreshLogBox default stuck error 1`] = `
"Foo.js (4:10) @ Foo
2 | // intentionally skips export
3 | export default function Foo() {
> 4 | return React.createElement('h1', null, 'Foo');
| ^
5 | }
6 | "
`;
exports[`ReactRefreshLogBox default syntax > runtime error 1`] = `
"index.js (6:16) @ Error
4 | setInterval(() => {
5 | i++
> 6 | throw Error('no ' + i)
| ^
7 | }, 1000)
8 | export default function FunctionNamed() {
9 | return <div />"
`;
exports[`ReactRefreshLogBox default syntax > runtime error 2`] = `
"./index.js
Error:
x Expected '}', got '<eof>'
,-[5:1]
5 | i++
6 | throw Error('no ' + i)
7 | }, 1000)
8 | export default function FunctionNamed() {
: ^
\`----
Caused by:
Syntax Error
Import trace for requested module:
./index.js"
`;
exports[`ReactRefreshLogBox default syntax > runtime error 3`] = `
"./index.js
Error:
x Expected '}', got '<eof>'
,-[5:1]
5 | i++
6 | throw Error('no ' + i)
7 | }, 1000)
8 | export default function FunctionNamed() {
: ^
\`----
Caused by:
Syntax Error
Import trace for requested module:
./index.js"
`;
exports[`ReactRefreshLogBox default unterminated JSX 1`] = ` exports[`ReactRefreshLogBox default unterminated JSX 1`] = `
"./index.js "./index.js
Error: Error:
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`ReactRefreshLogBox default syntax > runtime error 1`] = `
"index.js (6:16) @ Error
4 | setInterval(() => {
5 | i++
> 6 | throw Error('no ' + i)
| ^
7 | }, 1000)
8 | export default function FunctionNamed() {
9 | return <div />"
`;
exports[`ReactRefreshLogBox default syntax > runtime error 2`] = `
"./index.js
Error:
x Expected '}', got '<eof>'
,-[5:1]
5 | i++
6 | throw Error('no ' + i)
7 | }, 1000)
8 | export default function FunctionNamed() {
: ^
\`----
Caused by:
Syntax Error
Import trace for requested module:
./index.js"
`;
exports[`ReactRefreshLogBox default syntax > runtime error 3`] = `
"./index.js
Error:
x Expected '}', got '<eof>'
,-[5:1]
5 | i++
6 | throw Error('no ' + i)
7 | }, 1000)
8 | export default function FunctionNamed() {
: ^
\`----
Caused by:
Syntax Error
Import trace for requested module:
./index.js"
`;
This diff is collapsed.
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