@@ -2,9 +2,7 @@ import { nextTestSetup } from 'e2e-utils'
22import { getRedboxSource , openRedbox } from 'next-test-utils'
33
44// TODO: When owner stack is enabled by default, remove the condition and only keep one test
5- const isOwnerStackEnabled =
6- process . env . TEST_OWNER_STACK !== 'false' ||
7- process . env . __NEXT_EXPERIMENTAL_PPR === 'true'
5+ const isOwnerStackEnabled = process . env . __NEXT_EXPERIMENTAL_PPR === 'true'
86
97async function getStackFramesContent ( browser ) {
108 const stackFrameElements = await browser . elementsByCss (
@@ -33,29 +31,26 @@ async function getStackFramesContent(browser) {
3331 return stackFramesContent
3432}
3533
34+ // Without owner stack, the source is not available
3635; ( isOwnerStackEnabled ? describe . skip : describe ) (
3736 'app-dir - react-missing-key-prop' ,
3837 ( ) => {
3938 const { next } = nextTestSetup ( {
4039 files : __dirname ,
41- } )
40+ overrideFiles : {
41+ 'next.config.js' : `
42+ /**
43+ * @type {import('next').NextConfig}
44+ */
45+ const nextConfig = {
46+ experimental: {
47+ reactOwnerStack: false,
48+ },
49+ }
4250
43- let nextConfig : string = ''
44- beforeAll ( async ( ) => {
45- await next . stop ( )
46- await next . patchFile ( 'next.config.js' , ( content : string ) => {
47- nextConfig = content
48- return content . replace (
49- `reactOwnerStack: true` ,
50- `reactOwnerStack: false`
51- )
52- } )
53- await next . start ( )
54- } )
55- afterAll ( async ( ) => {
56- await next . stop ( )
57- // Restore original next.config.js
58- await next . patchFile ( 'next.config.js' , nextConfig )
51+ module.exports = nextConfig
52+ ` ,
53+ } ,
5954 } )
6055
6156 it ( 'should catch invalid element from on rsc component' , async ( ) => {
@@ -68,30 +63,29 @@ async function getStackFramesContent(browser) {
6863 if ( process . env . TURBOPACK ) {
6964 expect ( stackFramesContent ) . toMatchInlineSnapshot ( `""` )
7065 expect ( source ) . toMatchInlineSnapshot ( `
71- "app/rsc/page.tsx (5:5 ) @ Page
66+ "app/rsc/page.tsx (5:6 ) @ Page
7267
73- 3 | export default function Page() {
74- 4 | return (
75- > 5 | <div>
76- | ^
77- 6 | {list.map((item, index) => (
78- 7 | <span>{item}</span>
79- 8 | ))}"
80- ` )
68+ 3 | export default function Page() {
69+ 4 | return (
70+ > 5 | <div>
71+ | ^
72+ 6 | {list.map((item, index) => (
73+ 7 | <span>{item}</span>
74+ 8 | ))}"
75+ ` )
8176 } else {
8277 expect ( stackFramesContent ) . toMatchInlineSnapshot ( `""` )
83- // FIXME: the methodName should be `@ Page` instead of `@ div`
8478 expect ( source ) . toMatchInlineSnapshot ( `
85- "app/rsc/page.tsx (5:6) @ div
79+ "app/rsc/page.tsx (5:6) @ Page
8680
87- 3 | export default function Page() {
88- 4 | return (
89- > 5 | <div>
90- | ^
91- 6 | {list.map((item, index) => (
92- 7 | <span>{item}</span>
93- 8 | ))}"
94- ` )
81+ 3 | export default function Page() {
82+ 4 | return (
83+ > 5 | <div>
84+ | ^
85+ 6 | {list.map((item, index) => (
86+ 7 | <span>{item}</span>
87+ 8 | ))}"
88+ ` )
9589 }
9690 } )
9791
@@ -104,30 +98,29 @@ async function getStackFramesContent(browser) {
10498 if ( process . env . TURBOPACK ) {
10599 expect ( stackFramesContent ) . toMatchInlineSnapshot ( `""` )
106100 expect ( source ) . toMatchInlineSnapshot ( `
107- "app/ssr/page.tsx (7:5) @ Page
101+ "app/ssr/page.tsx (7:5) @ Page
108102
109- 5 | export default function Page() {
110- 6 | return (
111- > 7 | <div>
112- | ^
113- 8 | {list.map((item, index) => (
114- 9 | <p>{item}</p>
115- 10 | ))}"
116- ` )
103+ 5 | export default function Page() {
104+ 6 | return (
105+ > 7 | <div>
106+ | ^
107+ 8 | {list.map((item, index) => (
108+ 9 | <p>{item}</p>
109+ 10 | ))}"
110+ ` )
117111 } else {
118112 expect ( stackFramesContent ) . toMatchInlineSnapshot ( `""` )
119- // FIXME: the methodName should be `@ Page` instead of `@ div`
120113 expect ( source ) . toMatchInlineSnapshot ( `
121- "app/ssr/page.tsx (7:6) @ div
114+ "app/ssr/page.tsx (7:6) @ Page
122115
123- 5 | export default function Page() {
124- 6 | return (
125- > 7 | <div>
126- | ^
127- 8 | {list.map((item, index) => (
128- 9 | <p>{item}</p>
129- 10 | ))}"
130- ` )
116+ 5 | export default function Page() {
117+ 6 | return (
118+ > 7 | <div>
119+ | ^
120+ 8 | {list.map((item, index) => (
121+ 9 | <p>{item}</p>
122+ 10 | ))}"
123+ ` )
131124 }
132125 } )
133126 }
0 commit comments