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
5c24c444
Unverified
Commit
5c24c444
authored
Feb 26, 2026
by
Sebastian "Sebbie" Silbermann
Committed by
GitHub
Feb 26, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[test] Remove `getStackFramesContent` (#90571)
parent
d7db7440
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
89 additions
and
80 deletions
+89
-80
ReactRefreshLogBox.test.ts
test/development/acceptance/ReactRefreshLogBox.test.ts
+12
-4
error-ignored-frames.test.ts
...overlay/error-ignored-frames/error-ignored-frames.test.ts
+48
-28
owner-stack-react-missing-key-prop.test.ts
...ssing-key-prop/owner-stack-react-missing-key-prop.test.ts
+29
-21
next-test-utils.ts
test/lib/next-test-utils.ts
+0
-27
No files found.
test/development/acceptance/ReactRefreshLogBox.test.ts
View file @
5c24c444
...
@@ -3,7 +3,7 @@ import { createSandbox } from 'development-sandbox'
...
@@ -3,7 +3,7 @@ import { createSandbox } from 'development-sandbox'
import
{
FileRef
,
nextTestSetup
}
from
'e2e-utils'
import
{
FileRef
,
nextTestSetup
}
from
'e2e-utils'
import
{
import
{
getRedboxTotalErrorCount
,
getRedboxTotalErrorCount
,
get
StackFramesContent
,
get
RedboxCallStack
,
retry
,
retry
,
toggleCollapseCallStackFrames
,
toggleCollapseCallStackFrames
,
}
from
'next-test-utils'
}
from
'next-test-utils'
...
@@ -1435,7 +1435,7 @@ describe('ReactRefreshLogBox', () => {
...
@@ -1435,7 +1435,7 @@ describe('ReactRefreshLogBox', () => {
}
}
})
})
test
(
'should collapse nodejs internal stack frames from stack trace'
,
async
()
=>
{
test
(
'should collapse nodejs internal stack frames from stack trace
by default
'
,
async
()
=>
{
await
using
sandbox
=
await
createSandbox
(
await
using
sandbox
=
await
createSandbox
(
next
,
next
,
new
Map
([
new
Map
([
...
@@ -1474,7 +1474,15 @@ describe('ReactRefreshLogBox', () => {
...
@@ -1474,7 +1474,15 @@ describe('ReactRefreshLogBox', () => {
`
)
`
)
await
toggleCollapseCallStackFrames
(
browser
)
await
toggleCollapseCallStackFrames
(
browser
)
const
stackCollapsed
=
await
getStackFramesContent
(
browser
)
const
stackExpanded
=
await
getRedboxCallStack
(
browser
)
expect
(
stackCollapsed
).
toContain
(
'at new URL ()'
)
expect
(
stackExpanded
).
toEqual
(
expect
.
arrayContaining
([
expect
.
stringContaining
(
// ignore exact location.
// If this breaks, choose a different error that contains Node.js internals in its stack.
'new URL node:internal/url ('
),
])
)
})
})
})
})
test/development/app-dir/error-overlay/error-ignored-frames/error-ignored-frames.test.ts
View file @
5c24c444
import
{
nextTestSetup
}
from
'e2e-utils'
import
{
nextTestSetup
}
from
'e2e-utils'
import
{
import
{
waitForRedbox
,
waitForRedbox
,
get
StackFramesContent
,
get
RedboxCallStack
,
toggleCollapseCallStackFrames
,
toggleCollapseCallStackFrames
,
}
from
'next-test-utils'
}
from
'next-test-utils'
...
@@ -14,81 +14,101 @@ describe('error-ignored-frames', () => {
...
@@ -14,81 +14,101 @@ describe('error-ignored-frames', () => {
const
browser
=
await
next
.
browser
(
'/'
)
const
browser
=
await
next
.
browser
(
'/'
)
await
waitForRedbox
(
browser
)
await
waitForRedbox
(
browser
)
const
defaultStack
=
await
getStackFramesContent
(
browser
)
const
defaultStack
=
await
getRedboxCallStack
(
browser
)
expect
(
defaultStack
).
toMatchInlineSnapshot
(
`"at Page (app/page.tsx (2:9))"`
)
expect
(
defaultStack
).
toMatchInlineSnapshot
(
`
[
"Page app/page.tsx (2:9)",
]
`
)
await
toggleCollapseCallStackFrames
(
browser
)
await
toggleCollapseCallStackFrames
(
browser
)
const
expandedStack
=
await
getStackFramesContent
(
browser
)
const
expandedStack
=
await
getRedboxCallStack
(
browser
)
const
ignoreListedStack
=
expandedStack
.
replace
(
defaultStack
,
''
)
const
ignoreListedStack
=
expandedStack
.
filter
(
(
line
)
=>
!
defaultStack
.
includes
(
line
)
)
// We don't care about the exact stack trace that was ignore-listed.
// We don't care about the exact stack trace that was ignore-listed.
// It'll contain implementation details that may change and
// It'll contain implementation details that may change and
// shouldn't break this test.
// shouldn't break this test.
expect
(
ignoreListedStack
.
trim
()).
toMatch
(
/at .*/
)
expect
(
ignoreListedStack
).
not
.
toHaveLength
(
0
)
})
})
it
(
'should be able to collapse ignored frames in client component'
,
async
()
=>
{
it
(
'should be able to collapse ignored frames in client component'
,
async
()
=>
{
const
browser
=
await
next
.
browser
(
'/client'
)
const
browser
=
await
next
.
browser
(
'/client'
)
await
waitForRedbox
(
browser
)
await
waitForRedbox
(
browser
)
const
defaultStack
=
await
getStackFramesContent
(
browser
)
const
defaultStack
=
await
getRedboxCallStack
(
browser
)
expect
(
defaultStack
).
toMatchInlineSnapshot
(
expect
(
defaultStack
).
toMatchInlineSnapshot
(
`
`"at Page (app/client/page.tsx (4:9))"`
[
)
"Page app/client/page.tsx (4:9)",
]
`
)
await
toggleCollapseCallStackFrames
(
browser
)
await
toggleCollapseCallStackFrames
(
browser
)
const
expandedStack
=
await
getStackFramesContent
(
browser
)
const
expandedStack
=
await
getRedboxCallStack
(
browser
)
const
ignoreListedStack
=
expandedStack
.
replace
(
defaultStack
,
''
)
const
ignoreListedStack
=
expandedStack
.
filter
(
(
line
)
=>
!
defaultStack
.
includes
(
line
)
)
// We don't care about the exact stack trace that was ignore-listed.
// We don't care about the exact stack trace that was ignore-listed.
// It'll contain implementation details that may change and
// It'll contain implementation details that may change and
// shouldn't break this test.
// shouldn't break this test.
expect
(
ignoreListedStack
.
trim
()).
toMatch
(
/at .*/
)
expect
(
ignoreListedStack
).
not
.
toHaveLength
(
0
)
})
})
it
(
'should be able to collapse ignored frames in interleaved call stack'
,
async
()
=>
{
it
(
'should be able to collapse ignored frames in interleaved call stack'
,
async
()
=>
{
const
browser
=
await
next
.
browser
(
'/interleaved'
)
const
browser
=
await
next
.
browser
(
'/interleaved'
)
await
waitForRedbox
(
browser
)
await
waitForRedbox
(
browser
)
const
defaultStack
=
await
get
StackFramesContent
(
browser
)
const
defaultStack
=
await
get
RedboxCallStack
(
browser
)
if
(
isTurbopack
)
{
if
(
isTurbopack
)
{
expect
(
defaultStack
).
toMatchInlineSnapshot
(
`
expect
(
defaultStack
).
toMatchInlineSnapshot
(
`
"at <unknown> (app/interleaved/page.tsx (7:11))
[
at Page (app/interleaved/page.tsx (6:36))"
"<unknown> app/interleaved/page.tsx (7:11)",
"Page app/interleaved/page.tsx (6:36)",
]
`
)
`
)
}
else
{
}
else
{
expect
(
defaultStack
).
toMatchInlineSnapshot
(
`
expect
(
defaultStack
).
toMatchInlineSnapshot
(
`
"at eval (app/interleaved/page.tsx (7:11))
[
at Page (app/interleaved/page.tsx (6:36))"
"eval app/interleaved/page.tsx (7:11)",
"Page app/interleaved/page.tsx (6:36)",
]
`
)
`
)
}
}
await
toggleCollapseCallStackFrames
(
browser
)
await
toggleCollapseCallStackFrames
(
browser
)
const
expandedStack
=
await
getStackFramesContent
(
browser
)
const
expandedStack
=
await
getRedboxCallStack
(
browser
)
const
ignoreListedStack
=
expandedStack
.
replace
(
defaultStack
,
''
)
const
ignoreListedStack
=
expandedStack
.
filter
(
(
line
)
=>
!
defaultStack
.
includes
(
line
)
)
// We don't care about the exact stack trace that was ignore-listed.
// We don't care about the exact stack trace that was ignore-listed.
// It'll contain implementation details that may change and
// It'll contain implementation details that may change and
// shouldn't break this test.
// shouldn't break this test.
expect
(
ignoreListedStack
.
trim
()).
toMatch
(
/at .*/
)
expect
(
ignoreListedStack
).
not
.
toHaveLength
(
0
)
})
})
it
(
'should be able to collapse pages router ignored frames'
,
async
()
=>
{
it
(
'should be able to collapse pages router ignored frames'
,
async
()
=>
{
const
browser
=
await
next
.
browser
(
'/pages'
)
const
browser
=
await
next
.
browser
(
'/pages'
)
await
waitForRedbox
(
browser
)
await
waitForRedbox
(
browser
)
const
defaultStack
=
await
getStackFramesContent
(
browser
)
const
defaultStack
=
await
getRedboxCallStack
(
browser
)
expect
(
defaultStack
).
toMatchInlineSnapshot
(
expect
(
defaultStack
).
toMatchInlineSnapshot
(
`
`"at Page (pages/pages.tsx (2:9))"`
[
)
"Page pages/pages.tsx (2:9)",
]
`
)
await
toggleCollapseCallStackFrames
(
browser
)
await
toggleCollapseCallStackFrames
(
browser
)
const
expandedStack
=
await
getStackFramesContent
(
browser
)
const
expandedStack
=
await
getRedboxCallStack
(
browser
)
const
ignoreListedStack
=
expandedStack
.
replace
(
defaultStack
,
''
)
const
ignoreListedStack
=
expandedStack
.
filter
(
(
line
)
=>
!
defaultStack
.
includes
(
line
)
)
// We don't care about the exact stack trace that was ignore-listed.
// We don't care about the exact stack trace that was ignore-listed.
// It'll contain implementation details that may change and
// It'll contain implementation details that may change and
// shouldn't break this test.
// shouldn't break this test.
expect
(
ignoreListedStack
.
trim
()).
toMatch
(
/at .*/
)
expect
(
ignoreListedStack
).
not
.
toHaveLength
(
0
)
})
})
})
})
test/development/app-dir/owner-stack-react-missing-key-prop/owner-stack-react-missing-key-prop.test.ts
View file @
5c24c444
...
@@ -2,7 +2,7 @@ import { nextTestSetup } from 'e2e-utils'
...
@@ -2,7 +2,7 @@ import { nextTestSetup } from 'e2e-utils'
import
{
import
{
getRedboxSource
,
getRedboxSource
,
openRedbox
,
openRedbox
,
get
StackFramesContent
,
get
RedboxCallStack
,
}
from
'next-test-utils'
}
from
'next-test-utils'
describe
(
'app-dir - owner-stack-react-missing-key-prop'
,
()
=>
{
describe
(
'app-dir - owner-stack-react-missing-key-prop'
,
()
=>
{
...
@@ -14,15 +14,17 @@ describe('app-dir - owner-stack-react-missing-key-prop', () => {
...
@@ -14,15 +14,17 @@ describe('app-dir - owner-stack-react-missing-key-prop', () => {
const
browser
=
await
next
.
browser
(
'/rsc'
)
const
browser
=
await
next
.
browser
(
'/rsc'
)
await
openRedbox
(
browser
)
await
openRedbox
(
browser
)
const
stackFramesContent
=
await
get
StackFramesContent
(
browser
)
const
stackFramesContent
=
await
get
RedboxCallStack
(
browser
)
const
source
=
await
getRedboxSource
(
browser
)
const
source
=
await
getRedboxSource
(
browser
)
if
(
isTurbopack
)
{
if
(
isTurbopack
)
{
expect
(
stackFramesContent
).
toMatchInlineSnapshot
(
`
expect
(
stackFramesContent
).
toMatchInlineSnapshot
(
`
"at span ()
[
at <anonymous> (app/rsc/page.tsx (7:9))
"span <anonymous>",
at Array.map ()
"<anonymous> app/rsc/page.tsx (7:9)",
at Page (app/rsc/page.tsx (6:13))"
"Array.map <anonymous>",
"Page app/rsc/page.tsx (6:13)",
]
`
)
`
)
expect
(
source
).
toMatchInlineSnapshot
(
`
expect
(
source
).
toMatchInlineSnapshot
(
`
"app/rsc/page.tsx (7:9) @ <anonymous>
"app/rsc/page.tsx (7:9) @ <anonymous>
...
@@ -37,10 +39,12 @@ describe('app-dir - owner-stack-react-missing-key-prop', () => {
...
@@ -37,10 +39,12 @@ describe('app-dir - owner-stack-react-missing-key-prop', () => {
`
)
`
)
}
else
{
}
else
{
expect
(
stackFramesContent
).
toMatchInlineSnapshot
(
`
expect
(
stackFramesContent
).
toMatchInlineSnapshot
(
`
"at span ()
[
at eval (app/rsc/page.tsx (7:9))
"span <anonymous>",
at Array.map ()
"eval app/rsc/page.tsx (7:9)",
at Page (app/rsc/page.tsx (6:13))"
"Array.map <anonymous>",
"Page app/rsc/page.tsx (6:13)",
]
`
)
`
)
expect
(
source
).
toMatchInlineSnapshot
(
`
expect
(
source
).
toMatchInlineSnapshot
(
`
"app/rsc/page.tsx (7:9) @ eval
"app/rsc/page.tsx (7:9) @ eval
...
@@ -60,15 +64,17 @@ describe('app-dir - owner-stack-react-missing-key-prop', () => {
...
@@ -60,15 +64,17 @@ describe('app-dir - owner-stack-react-missing-key-prop', () => {
const
browser
=
await
next
.
browser
(
'/ssr'
)
const
browser
=
await
next
.
browser
(
'/ssr'
)
await
openRedbox
(
browser
)
await
openRedbox
(
browser
)
const
stackFramesContent
=
await
get
StackFramesContent
(
browser
)
const
stackFramesContent
=
await
get
RedboxCallStack
(
browser
)
const
source
=
await
getRedboxSource
(
browser
)
const
source
=
await
getRedboxSource
(
browser
)
if
(
isTurbopack
)
{
if
(
isTurbopack
)
{
expect
(
stackFramesContent
).
toMatchInlineSnapshot
(
`
expect
(
stackFramesContent
).
toMatchInlineSnapshot
(
`
"at p ()
[
at <unknown> (app/ssr/page.tsx (9:9))
"p <anonymous>",
at Array.map ()
"<unknown> app/ssr/page.tsx (9:9)",
at Page (app/ssr/page.tsx (8:13))"
"Array.map <anonymous>",
`
)
"Page app/ssr/page.tsx (8:13)",
]
`
)
expect
(
source
).
toMatchInlineSnapshot
(
`
expect
(
source
).
toMatchInlineSnapshot
(
`
"app/ssr/page.tsx (9:9) @ <unknown>
"app/ssr/page.tsx (9:9) @ <unknown>
...
@@ -82,11 +88,13 @@ describe('app-dir - owner-stack-react-missing-key-prop', () => {
...
@@ -82,11 +88,13 @@ describe('app-dir - owner-stack-react-missing-key-prop', () => {
`
)
`
)
}
else
{
}
else
{
expect
(
stackFramesContent
).
toMatchInlineSnapshot
(
`
expect
(
stackFramesContent
).
toMatchInlineSnapshot
(
`
"at p ()
[
at eval (app/ssr/page.tsx (9:9))
"p <anonymous>",
at Array.map ()
"eval app/ssr/page.tsx (9:9)",
at Page (app/ssr/page.tsx (8:13))"
"Array.map <anonymous>",
`
)
"Page app/ssr/page.tsx (8:13)",
]
`
)
expect
(
source
).
toMatchInlineSnapshot
(
`
expect
(
source
).
toMatchInlineSnapshot
(
`
"app/ssr/page.tsx (9:9) @ eval
"app/ssr/page.tsx (9:9) @ eval
...
...
test/lib/next-test-utils.ts
View file @
5c24c444
...
@@ -1858,33 +1858,6 @@ export const checkLink = (
...
@@ -1858,33 +1858,6 @@ export const checkLink = (
content
:
string
|
string
[]
content
:
string
|
string
[]
)
=>
checkMeta
(
browser
,
rel
,
content
,
'rel'
,
'link'
,
'href'
)
)
=>
checkMeta
(
browser
,
rel
,
content
,
'rel'
,
'link'
,
'href'
)
export
async
function
getStackFramesContent
(
browser
)
{
const
stackFrameElements
=
await
browser
.
elementsByCss
(
'[data-nextjs-call-stack-frame]'
)
const
stackFramesContent
=
(
await
Promise
.
all
(
stackFrameElements
.
map
(
async
(
frame
)
=>
{
const
functionNameEl
=
await
frame
.
$
(
'.call-stack-frame-method-name'
)
const
fileEl
=
await
frame
.
$
(
'[data-has-original-code-frame="true"]'
)
const
functionName
=
functionNameEl
?
await
functionNameEl
.
innerText
()
:
''
const
file
=
fileEl
?
await
fileEl
.
innerText
()
:
''
if
(
!
functionName
)
{
return
''
}
return
`at
${
functionName
}
(
${
file
}
)`
})
)
)
.
filter
(
Boolean
)
.
join
(
'
\
n'
)
return
stackFramesContent
}
export
async
function
toggleCollapseCallStackFrames
(
browser
:
Playwright
)
{
export
async
function
toggleCollapseCallStackFrames
(
browser
:
Playwright
)
{
const
button
=
await
browser
.
elementByCss
(
const
button
=
await
browser
.
elementByCss
(
'[data-nextjs-call-stack-ignored-list-toggle-button]'
'[data-nextjs-call-stack-ignored-list-toggle-button]'
...
...
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