diff --git a/test/development/acceptance-app/ReactRefreshLogBoxMisc.test.ts b/test/development/acceptance-app/ReactRefreshLogBoxMisc.test.ts index d92072c618f5c..dcae3d320623f 100644 --- a/test/development/acceptance-app/ReactRefreshLogBoxMisc.test.ts +++ b/test/development/acceptance-app/ReactRefreshLogBoxMisc.test.ts @@ -3,210 +3,15 @@ import { FileRef, nextTestSetup } from 'e2e-utils' import path from 'path' import { outdent } from 'outdent' -// TODO: re-enable these tests after figuring out what is causing -// them to be so unreliable in CI -describe.skip('ReactRefreshLogBox app', () => { - const { next } = nextTestSetup({ +describe('ReactRefreshLogBox app', () => { + const { isTurbopack, next } = nextTestSetup({ files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')), skipStart: true, }) - test(' with multiple children', async () => { - await using sandbox = await createSandbox(next) - const { session } = sandbox - - await session.patch( - 'index.js', - outdent` - import Link from 'next/link' - - export default function Index() { - return ( - -

One

-

Two

- - ) - } - ` - ) - - await session.assertHasRedbox() - expect(await session.getRedboxDescription()).toMatchInlineSnapshot( - `"Error: Multiple children were passed to with \`href\` of \`/\` but only one child is supported https://nextjs.org/docs/messages/link-multiple-children"` - ) - expect( - await session.evaluate( - () => - ( - document - .querySelector('body > nextjs-portal') - .shadowRoot.querySelector( - '#nextjs__container_errors_desc a:nth-of-type(1)' - ) as any - ).href - ) - ).toMatch('https://nextjs.org/docs/messages/link-multiple-children') - }) - - test(' component props errors', async () => { - await using sandbox = await createSandbox(next) - const { session } = sandbox - - await session.patch( - 'index.js', - outdent` - import Link from 'next/link' - - export default function Hello() { - return - } - ` - ) - - await session.assertHasRedbox() - expect(await session.getRedboxDescription()).toMatchInlineSnapshot( - `"Error: Failed prop type: The prop \`href\` expects a \`string\` or \`object\` in \`\`, but got \`undefined\` instead."` - ) - - await session.patch( - 'index.js', - outdent` - import Link from 'next/link' - - export default function Hello() { - return Abc - } - ` - ) - await session.assertNoRedbox() - - await session.patch( - 'index.js', - outdent` - import Link from 'next/link' - - export default function Hello() { - return ( - - Abc - - ) - } - ` - ) - await session.assertNoRedbox() - - await session.patch( - 'index.js', - outdent` - import Link from 'next/link' - - export default function Hello() { - return ( - - Abc - - ) - } - ` - ) - await session.assertNoRedbox() - - await session.patch( - 'index.js', - outdent` - import Link from 'next/link' - - export default function Hello() { - return ( - - Abc - - ) - } - ` - ) - await session.assertNoRedbox() - - await session.patch( - 'index.js', - outdent` - import Link from 'next/link' - - export default function Hello() { - return ( - - Abc - - ) - } - ` - ) - await session.assertHasRedbox() - expect(await session.getRedboxDescription()).toMatchSnapshot() - - await session.patch( - 'index.js', - outdent` - import Link from 'next/link' - - export default function Hello() { - return ( - - Abc - - ) - } - ` - ) - await session.assertHasRedbox() - expect(await session.getRedboxDescription()).toMatchSnapshot() - }) - test('server-side only compilation errors', async () => { await using sandbox = await createSandbox(next) - const { session } = sandbox + const { browser, session } = sandbox await session.patch( 'app/page.js', @@ -226,6 +31,45 @@ describe.skip('ReactRefreshLogBox app', () => { ` ) - await session.assertHasRedbox() + if (isTurbopack) { + await expect(browser).toDisplayRedbox(` + { + "count": 1, + "description": "Ecmascript file had an error", + "environmentLabel": null, + "label": "Build Error", + "source": "./app/page.js (3:23) + Ecmascript file had an error + > 3 | export async function getStaticProps() { + | ^^^^^^^^^^^^^^", + "stack": [], + } + `) + } else { + await expect(browser).toDisplayRedbox(` + { + "count": 1, + "description": "Error: x "getStaticProps" is not supported in app/. Read more: https://nextjs.org/docs/app/building-your-application/data-fetching", + "environmentLabel": null, + "label": "Build Error", + "source": "./app/page.js + Error: x "getStaticProps" is not supported in app/. Read more: https://nextjs.org/docs/app/building-your-application/data-fetching + | + | + ,-[3:1] + 1 | 'use client' + 2 | import myLibrary from 'my-non-existent-library' + 3 | export async function getStaticProps() { + : ^^^^^^^^^^^^^^ + 4 | return { + 5 | props: { + 6 | result: myLibrary() + \`---- + Import trace for requested module: + ./app/page.js", + "stack": [], + } + `) + } }) })