Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
94d97d12
Unverified
Commit
94d97d12
authored
Feb 24, 2025
by
Sebastian "Sebbie" Silbermann
Committed by
GitHub
Feb 24, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[test] Use new Redbox matchers in app/ ReactRefreshLogBox (#76431)
parent
669c52e3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
762 additions
and
540 deletions
+762
-540
ReactRefreshLogBox.test.ts
test/development/acceptance-app/ReactRefreshLogBox.test.ts
+756
-324
ReactRefreshLogBox.test.ts.snap
...eptance-app/__snapshots__/ReactRefreshLogBox.test.ts.snap
+0
-215
add-redbox-matchers.ts
test/lib/add-redbox-matchers.ts
+6
-1
No files found.
test/development/acceptance-app/ReactRefreshLogBox.test.ts
View file @
94d97d12
This diff is collapsed.
Click to expand it.
test/development/acceptance-app/__snapshots__/ReactRefreshLogBox.test.ts.snap
deleted
100644 → 0
View file @
669c52e3
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`ReactRefreshLogBox app default Import trace when module not found in layout 1`] = `
"./app/module.js (1:1)
Module not found: Can't resolve 'non-existing-module'
> 1 | import "non-existing-module"
| ^
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./app/layout.js"
`;
exports[`ReactRefreshLogBox app default Should not show __webpack_exports__ when exporting anonymous arrow function 1`] = `
"index.js (3:11) @ 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
> 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
2 | export default class ClickCount extends Component {
3 | render() {
> 4 | throw new Error()
| ^
5 | }
6 | }"
`;
exports[`ReactRefreshLogBox app default css syntax errors 1`] = `
"./index.module.css (1:1)
Syntax error: Selector "button" is not pure (pure selectors must contain at least one local class or id)
> 1 | button {}
| ^"
`;
exports[`ReactRefreshLogBox app default logbox: anchors links in error messages 1`] = `"Error: end https://nextjs.org"`;
exports[`ReactRefreshLogBox app default logbox: anchors links in error messages 2`] = `"https://nextjs.org/"`;
exports[`ReactRefreshLogBox app default logbox: anchors links in error messages 3`] = `"Error: https://nextjs.org start"`;
exports[`ReactRefreshLogBox app default logbox: anchors links in error messages 4`] = `"https://nextjs.org/"`;
exports[`ReactRefreshLogBox app default logbox: anchors links in error messages 5`] = `"Error: middle https://nextjs.org end"`;
exports[`ReactRefreshLogBox app default logbox: anchors links in error messages 6`] = `"https://nextjs.org/"`;
exports[`ReactRefreshLogBox app default logbox: anchors links in error messages 7`] = `"https://nextjs.org/"`;
exports[`ReactRefreshLogBox app default module init error not shown 1`] = `
"index.js (3:7) @ 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 hide unrelated frames in stack trace with nodejs internal calls 1`] = `
"app/page.js (2:3) @ Page
1 | export default function Page() {
> 2 | new URL("/", "invalid");
| ^
3 | }"
`;
exports[`ReactRefreshLogBox app default should hide unrelated frames in stack trace with unknown anonymous calls 1`] = `
"app/page.js (4:13) @ eval
2 | try {
3 | (function() {
> 4 | throw new Error("This is an error from an anonymous function");
| ^
5 | })();
6 | } catch (e) {
7 | throw e"
`;
exports[`ReactRefreshLogBox app default should strip whitespace correctly with newline 1`] = `
"index.js (7:15) @ onClick
5 |
6 | <a onClick={() => {
> 7 | throw new Error('idk')
| ^
8 | }}>
9 | click me
10 | </a>"
`;
exports[`ReactRefreshLogBox app turbo Import trace when module not found in layout 1`] = `
"./app/module.js (1:1)
Module not found: Can't resolve 'non-existing-module'
> 1 | import "non-existing-module"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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}
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
> 1 | export default function FunctionDefault() { throw new Error('no'); }
| ^"
`;
exports[`ReactRefreshLogBox app turbo conversion to class component (1) 1`] = `
"Child.js (4:11) @ ClickCount.render
2 | export default class ClickCount extends Component {
3 | render() {
> 4 | throw new Error()
| ^
5 | }
6 | }"
`;
exports[`ReactRefreshLogBox app turbo css syntax errors 1`] = `
"./index.module.css
Parsing css source code failed
Selector is not pure (pure selectors must contain at least one local class or id), (lightningcss, Selector(button, specificity = 0x1))"
`;
exports[`ReactRefreshLogBox app turbo logbox: anchors links in error messages 1`] = `"Error: end https://nextjs.org"`;
exports[`ReactRefreshLogBox app turbo logbox: anchors links in error messages 2`] = `"https://nextjs.org/"`;
exports[`ReactRefreshLogBox app turbo logbox: anchors links in error messages 3`] = `"Error: https://nextjs.org start"`;
exports[`ReactRefreshLogBox app turbo logbox: anchors links in error messages 4`] = `"https://nextjs.org/"`;
exports[`ReactRefreshLogBox app turbo logbox: anchors links in error messages 5`] = `"Error: middle https://nextjs.org end"`;
exports[`ReactRefreshLogBox app turbo logbox: anchors links in error messages 6`] = `"https://nextjs.org/"`;
exports[`ReactRefreshLogBox app turbo logbox: anchors links in error messages 7`] = `"https://nextjs.org/"`;
exports[`ReactRefreshLogBox app turbo module init error not shown 1`] = `
"index.js (3:7) @ [project]/index.js [app-client] (ecmascript)
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 hide unrelated frames in stack trace with nodejs internal calls 1`] = `
"app/page.js (2:3) @ Page
1 | export default function Page() {
> 2 | new URL("/", "invalid");
| ^
3 | }"
`;
exports[`ReactRefreshLogBox app turbo should hide unrelated frames in stack trace with unknown anonymous calls 1`] = `
"app/page.js (4:13) @ <anonymous>
2 | try {
3 | (function() {
> 4 | throw new Error("This is an error from an anonymous function");
| ^
5 | })();
6 | } catch (e) {
7 | throw e"
`;
exports[`ReactRefreshLogBox app turbo should strip whitespace correctly with newline 1`] = `
"index.js (7:15) @ onClick
5 |
6 | <a onClick={() => {
> 7 | throw new Error('idk')
| ^
8 | }}>
9 | click me
10 | </a>"
`;
test/lib/add-redbox-matchers.ts
View file @
94d97d12
...
@@ -151,7 +151,12 @@ async function createRedboxSnapshot(
...
@@ -151,7 +151,12 @@ async function createRedboxSnapshot(
?
description
.
replace
(
next
.
testDir
,
'<FIXME-project-root>'
)
?
description
.
replace
(
next
.
testDir
,
'<FIXME-project-root>'
)
:
description
,
:
description
,
source
:
focusedSource
,
source
:
focusedSource
,
stack
,
stack
:
next
!==
null
?
stack
.
map
((
stackframe
)
=>
{
return
stackframe
.
replace
(
next
.
testDir
,
'<FIXME-project-root>'
)
})
:
stack
,
// TODO(newDevOverlay): Always return `count`. Normalizing currently to avoid assertion forks.
// TODO(newDevOverlay): Always return `count`. Normalizing currently to avoid assertion forks.
count
:
label
===
'Build Error'
&&
count
===
-
1
?
1
:
count
,
count
:
label
===
'Build Error'
&&
count
===
-
1
?
1
:
count
,
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment