import { nextTestSetup } from 'e2e-utils' import { getRedboxSource, openRedbox, getStackFramesContent, } from 'next-test-utils' describe('app-dir - owner-stack-react-missing-key-prop', () => { const { isTurbopack, next } = nextTestSetup({ files: __dirname, }) it('should catch invalid element from on rsc component', async () => { const browser = await next.browser('/rsc') await openRedbox(browser) const stackFramesContent = await getStackFramesContent(browser) const source = await getRedboxSource(browser) if (isTurbopack) { expect(stackFramesContent).toMatchInlineSnapshot(` "at span () at (app/rsc/page.tsx (7:9)) at Array.map () at Page (app/rsc/page.tsx (6:13))" `) expect(source).toMatchInlineSnapshot(` "app/rsc/page.tsx (7:9) @ 5 |
6 | {list.map((item, index) => ( > 7 | {item} | ^ 8 | ))} 9 |
10 | )" `) } else { expect(stackFramesContent).toMatchInlineSnapshot(` "at span () at eval (app/rsc/page.tsx (7:9)) at Array.map () at Page (app/rsc/page.tsx (6:13))" `) expect(source).toMatchInlineSnapshot(` "app/rsc/page.tsx (7:9) @ eval 5 |
6 | {list.map((item, index) => ( > 7 | {item} | ^ 8 | ))} 9 |
10 | )" `) } }) it('should catch invalid element from on ssr client component', async () => { const browser = await next.browser('/ssr') await openRedbox(browser) const stackFramesContent = await getStackFramesContent(browser) const source = await getRedboxSource(browser) if (isTurbopack) { expect(stackFramesContent).toMatchInlineSnapshot(` "at p () at (app/ssr/page.tsx (9:9)) at Array.map () at Page (app/ssr/page.tsx (8:13))" `) expect(source).toMatchInlineSnapshot(` "app/ssr/page.tsx (9:9) @ 7 |
8 | {list.map((item, index) => ( > 9 |

{item}

| ^ 10 | ))} 11 |
12 | )" `) } else { expect(stackFramesContent).toMatchInlineSnapshot(` "at p () at eval (app/ssr/page.tsx (9:9)) at Array.map () at Page (app/ssr/page.tsx (8:13))" `) expect(source).toMatchInlineSnapshot(` "app/ssr/page.tsx (9:9) @ eval 7 |
8 | {list.map((item, index) => ( > 9 |

{item}

| ^ 10 | ))} 11 |
12 | )" `) } }) })