Unverified Commit 1c85b755 authored by Zack Tanner's avatar Zack Tanner Committed by GitHub

[DevOverlay]: enable by default (#75882)

- `newDevOverlay: true` by default (enables experimental React builds on
canary until owner stacks progress further)
- `run-tests` now sets the env var for tests that were relying on it for
forking behavior
- PPR runners now run with the flag disabled to help catch regressions
in the old overlay until we remove it
- Fixed a number of tests that had outdated snapshots or missed forking
behavior because they weren't running in CI
- Disabled a test that was failing in Turbopack + Experimental React
that is unrelated to the overlay (see:
https://github.com/vercel/next.js/pull/75989)

---------
Co-authored-by: 's avatardevjiwonchoi <devjiwonchoi@gmail.com>
parent ed676009
......@@ -45,7 +45,11 @@
"jest/no-conditional-expect": "off",
"jest/valid-title": "off",
"jest/no-interpolation-in-snapshots": "off",
"jest/no-export": "off"
"jest/no-export": "off",
"jest/no-standalone-expect": [
"error",
{ "additionalTestBlockFunctions": ["retry"] }
]
}
},
{ "files": ["**/__tests__/**"], "env": { "jest": true } },
......
......@@ -581,7 +581,7 @@ jobs:
uses: ./.github/workflows/build_reusable.yml
with:
nodeVersion: 18.18.2
afterBuild: __NEXT_EXPERIMENTAL_PPR=true __NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY=true NEXT_EXTERNAL_TESTS_FILTERS="test/ppr-tests-manifest.json" node run-tests.js --timings -c ${TEST_CONCURRENCY} --type integration
afterBuild: __NEXT_EXPERIMENTAL_PPR=true __NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY=false NEXT_EXTERNAL_TESTS_FILTERS="test/ppr-tests-manifest.json" node run-tests.js --timings -c ${TEST_CONCURRENCY} --type integration
stepName: 'test-ppr-integration'
secrets: inherit
......@@ -596,7 +596,7 @@ jobs:
group: [1/6, 2/6, 3/6, 4/6, 5/6, 6/6]
uses: ./.github/workflows/build_reusable.yml
with:
afterBuild: __NEXT_EXPERIMENTAL_PPR=true __NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY=true NEXT_EXTERNAL_TESTS_FILTERS="test/ppr-tests-manifest.json" NEXT_TEST_MODE=dev node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type development
afterBuild: __NEXT_EXPERIMENTAL_PPR=true __NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY=false NEXT_EXTERNAL_TESTS_FILTERS="test/ppr-tests-manifest.json" NEXT_TEST_MODE=dev node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type development
stepName: 'test-ppr-dev-${{ matrix.group }}'
secrets: inherit
......@@ -611,7 +611,7 @@ jobs:
group: [1/7, 2/7, 3/7, 4/7, 5/7, 6/7, 7/7]
uses: ./.github/workflows/build_reusable.yml
with:
afterBuild: __NEXT_EXPERIMENTAL_PPR=true __NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY=true NEXT_EXTERNAL_TESTS_FILTERS="test/ppr-tests-manifest.json" NEXT_TEST_MODE=start node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type production
afterBuild: __NEXT_EXPERIMENTAL_PPR=true __NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY=false NEXT_EXTERNAL_TESTS_FILTERS="test/ppr-tests-manifest.json" NEXT_TEST_MODE=start node run-tests.js --timings -g ${{ matrix.group }} -c ${TEST_CONCURRENCY} --type production
stepName: 'test-ppr-prod-${{ matrix.group }}'
secrets: inherit
......
......@@ -262,6 +262,7 @@ function DevToolsPopover({
<div className="footer">
<MenuItem
data-hide-dev-tools
label="Hide Dev Tools"
value={<HideShortcut />}
onClick={hide}
......
......@@ -415,6 +415,7 @@ export const NextLogo = forwardRef(function NextLogo(
<button
ref={mergeRefs(triggerRef, propRef)}
data-next-mark
data-next-mark-loading={isLoading}
onClick={onTriggerClick}
{...props}
>
......
......@@ -9,7 +9,7 @@ type EditorLinkProps = {
column: number
}
}
export function EditorLink({ file, isSourceFile, location }: EditorLinkProps) {
export function EditorLink({ file, location }: EditorLinkProps) {
const open = useOpenInEditor({
file,
lineNumber: location?.line ?? 1,
......@@ -19,12 +19,7 @@ export function EditorLink({ file, isSourceFile, location }: EditorLinkProps) {
return (
<div
data-with-open-in-editor-link
data-with-open-in-editor-link-source-file={
isSourceFile ? true : undefined
}
data-with-open-in-editor-link-import-trace={
isSourceFile ? undefined : true
}
data-with-open-in-editor-link-import-trace
tabIndex={10}
role={'link'}
onClick={open}
......@@ -64,11 +59,4 @@ export const EDITOR_LINK_STYLES = css`
[data-with-open-in-editor-link-import-trace] {
margin-left: var(--size-gap-double);
}
[data-with-open-in-editor-link-source-file] {
border-bottom: 1px solid var(--color-ansi-bright-black);
display: flex;
align-items: center;
justify-content: space-between;
line-break: anywhere;
}
`
......@@ -77,8 +77,8 @@ export const Terminal: React.FC<TerminalProps> = function Terminal({
const open = useOpenInEditor({
file: file?.fileName,
lineNumber: file?.location?.line,
column: file?.location?.column,
lineNumber: file?.location?.line ?? 1,
column: file?.location?.column ?? 0,
})
const stackFrame = {
......@@ -96,6 +96,7 @@ export const Terminal: React.FC<TerminalProps> = function Terminal({
<button
aria-label="Open in editor"
className="code-frame-header"
data-with-open-in-editor-link-source-file
onClick={open}
>
<div className="code-frame-link">
......
......@@ -1253,7 +1253,7 @@ export const defaultConfig: NextConfig = {
staticGenerationMinPagesPerWorker: 25,
dynamicIO: false,
inlineCss: false,
newDevOverlay: false,
newDevOverlay: true,
streamingMetadata: false,
htmlLimitedBots: undefined,
useCache: undefined,
......
......@@ -923,8 +923,8 @@ function assignDefaults(
// TODO(jiwon): remove once we've made new UI default
// Enable reactOwnerStack when newDevOverlay is enabled to have
// better call stack output in the new UI.
if (process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true') {
result.experimental.newDevOverlay = true
if (process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'false') {
result.experimental.newDevOverlay = false
}
if (result.experimental.newDevOverlay) {
result.experimental.reactOwnerStack = true
......
......@@ -50,6 +50,12 @@ const ENDGROUP = process.env.CI ? '##[endgroup]' : ''
const externalTestsFilter = getTestFilter()
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
if (!process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY) {
console.log('Setting __NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY to true')
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY = 'true'
}
const timings = []
const DEFAULT_NUM_RETRIES = 2
const DEFAULT_CONCURRENCY = 2
......
......@@ -50,7 +50,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
await session.assertHasRedbox()
if (process.env.TURBOPACK) {
expect(await session.getRedboxSource()).toMatchInlineSnapshot(`
"./node_modules/my-package/index.js:1:13
"./node_modules/my-package/index.js (1:13)
Module not found: Can't resolve 'dns'
> 1 | const dns = require('dns')
| ^^^^^^^^^^^^^^
......@@ -60,7 +60,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
`)
} else {
expect(await session.getRedboxSource()).toMatchInlineSnapshot(`
"./node_modules/my-package/index.js:1:1
"./node_modules/my-package/index.js (1:1)
Module not found: Can't resolve 'dns'
> 1 | const dns = require('dns')
| ^
......@@ -98,7 +98,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
const source = await session.getRedboxSource()
if (process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(`
"./index.js:1:1
"./index.js (1:1)
Module not found: Can't resolve 'b'
> 1 | import Comp from 'b'
| ^^^^^^^^^^^^^^^^^^^^
......@@ -110,7 +110,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
`)
} else {
expect(source).toMatchInlineSnapshot(`
"./index.js:1:1
"./index.js (1:1)
Module not found: Can't resolve 'b'
> 1 | import Comp from 'b'
| ^
......@@ -150,7 +150,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
const source = await session.getRedboxSource()
if (process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(`
"./app/page.js:2:1
"./app/page.js (2:1)
Module not found: Can't resolve 'b'
1 | 'use client'
> 2 | import Comp from 'b'
......@@ -163,7 +163,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
`)
} else {
expect(source).toMatchInlineSnapshot(`
"./app/page.js:2:1
"./app/page.js (2:1)
Module not found: Can't resolve 'b'
1 | 'use client'
> 2 | import Comp from 'b'
......@@ -199,7 +199,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
const source = await session.getRedboxSource()
if (process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(`
"./app/page.js:2:1
"./app/page.js (2:1)
Module not found: Can't resolve './non-existent.css'
1 | 'use client'
> 2 | import './non-existent.css'
......@@ -212,7 +212,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
`)
} else {
expect(source).toMatchInlineSnapshot(`
"./app/page.js:2:1
"./app/page.js (2:1)
Module not found: Can't resolve './non-existent.css'
1 | 'use client'
> 2 | import './non-existent.css'
......
......@@ -2,11 +2,11 @@
import { createSandbox } from 'development-sandbox'
import { FileRef, nextTestSetup } from 'e2e-utils'
import {
check,
describeVariants as describe,
getStackFramesContent,
retry,
getRedboxCallStack,
getToastErrorCount,
} from 'next-test-utils'
import path from 'path'
import { outdent } from 'outdent'
......@@ -220,7 +220,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
const source = next.normalizeTestDirContent(await session.getRedboxSource())
if (isTurbopack) {
expect(source).toEqual(outdent`
./index.js:7:1
./index.js (7:1)
Parsing ecmascript source code failed
5 | div
6 | )
......@@ -351,7 +351,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
await session.assertHasRedbox()
const source = await session.getRedboxSource()
expect(source).toMatch(
isTurbopack ? './index.module.css:1:9' : './index.module.css:1:1'
isTurbopack ? './index.module.css (1:9)' : './index.module.css (1:1)'
)
if (!isTurbopack) {
expect(source).toMatch('Syntax error: ')
......@@ -436,7 +436,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
)
await session.evaluate(() => document.querySelector('button').click())
await session.openRedbox()
await session.assertHasRedbox()
const header2 = await session.getRedboxDescription()
expect(header2).toMatchSnapshot()
......@@ -481,7 +481,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
)
await session.evaluate(() => document.querySelector('button').click())
await session.openRedbox()
await session.assertHasRedbox()
const header3 = await session.getRedboxDescription()
expect(header3).toMatchSnapshot()
......@@ -526,7 +526,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
)
await session.evaluate(() => document.querySelector('button').click())
await session.openRedbox()
await session.assertHasRedbox()
const header4 = await session.getRedboxDescription()
expect(header4).toEqual(
......@@ -735,23 +735,15 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
await session.patch('index.js', file)
// Unhandled error and rejection in setTimeout
expect(
await browser.waitForElementByCss('.nextjs-toast-errors').text()
).toBe('2 issues')
expect(await getToastErrorCount(browser)).toBe(2)
// Unhandled error in event handler
await browser.elementById('unhandled-error').click()
await check(
() => browser.elementByCss('.nextjs-toast-errors').text(),
/3 issues/
)
expect(await getToastErrorCount(browser)).toBe(3)
// Unhandled rejection in event handler
await browser.elementById('unhandled-rejection').click()
await check(
() => browser.elementByCss('.nextjs-toast-errors').text(),
/4 issues/
)
expect(await getToastErrorCount(browser)).toBe(4)
await session.assertNoRedbox()
// Add Component error
......@@ -1059,7 +1051,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
await session.assertHasRedbox()
if (isTurbopack) {
expect(await session.getRedboxSource()).toEqual(outdent`
./app/styles2.css:1:2
./app/styles2.css (1:2)
Module not found: Can't resolve './boom.css'
> 1 | @import "./boom.css"
| ^
......
......@@ -280,7 +280,8 @@ describe('ReactRefreshRegression app', () => {
await session.assertHasRedbox()
const source = await session.getRedboxSource()
expect(source.split(/\r?\n/g).slice(2).join('\n')).toMatchInlineSnapshot(`
expect(source.split(/\r?\n/g).slice(2).join('\n').replace(/^\n+/, ''))
.toMatchInlineSnapshot(`
"> 1 | export default function () { throw new Error('boom'); }
| ^"
`)
......@@ -298,7 +299,8 @@ describe('ReactRefreshRegression app', () => {
await session.assertHasRedbox()
const source = await session.getRedboxSource()
expect(source.split(/\r?\n/g).slice(2).join('\n')).toMatchInlineSnapshot(`
expect(source.split(/\r?\n/g).slice(2).join('\n').replace(/^\n+/, ''))
.toMatchInlineSnapshot(`
"> 1 | export default function Page() { throw new Error('boom'); }
| ^"
`)
......@@ -319,7 +321,8 @@ describe('ReactRefreshRegression app', () => {
await session.assertHasRedbox()
const source = await session.getRedboxSource()
expect(source.split(/\r?\n/g).slice(2).join('\n')).toMatchInlineSnapshot(`
expect(source.split(/\r?\n/g).slice(2).join('\n').replace(/^\n+/, ''))
.toMatchInlineSnapshot(`
" 1 | 'use client'
> 2 | export default function Page() { throw new Error('boom'); }
| ^"
......
// 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
"./app/module.js (1:1)
Module not found: Can't resolve 'non-existing-module'
> 1 | import "non-existing-module"
| ^
......@@ -43,7 +43,7 @@ exports[`ReactRefreshLogBox app default conversion to class component (1) 1`] =
`;
exports[`ReactRefreshLogBox app default css syntax errors 1`] = `
"./index.module.css:1: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 {}
......@@ -110,7 +110,7 @@ exports[`ReactRefreshLogBox app default should strip whitespace correctly with n
`;
exports[`ReactRefreshLogBox app turbo Import trace when module not found in layout 1`] = `
"./app/module.js:1:1
"./app/module.js (1:1)
Module not found: Can't resolve 'non-existing-module'
> 1 | import "non-existing-module"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
......@@ -119,7 +119,8 @@ 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}
"index.js (3:11) @
{default export}
1 | export default () => {
2 | if (typeof window !== 'undefined') {
......
......@@ -22,7 +22,9 @@ describe('Error overlay - error message urls', () => {
await session.assertHasRedbox()
const link = await browser.elementByCss('[data-nextjs-terminal] a')
const link = await browser.elementByCss(
'[data-nextjs-terminal] a, [data-nextjs-codeframe] a'
)
const text = await link.text()
const href = await link.getAttribute('href')
expect(text).toEqual(
......
......@@ -7,7 +7,9 @@ import { getRedboxTotalErrorCount, retry } from 'next-test-utils'
// https://github.com/facebook/react/blob/main/packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js used as a reference
const enableOwnerStacks = process.env.__NEXT_EXPERIMENTAL_PPR === 'true'
const enableOwnerStacks =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true' ||
process.env.__NEXT_EXPERIMENTAL_PPR === 'true'
describe('Error overlay for hydration errors in App router', () => {
const { next, isTurbopack } = nextTestSetup({
......@@ -220,6 +222,7 @@ describe('Error overlay for hydration errors in App router', () => {
"...
<HotReload assetPrefix="" globalError={[...]}>
<ReactDevOverlay state={{nextId:1, ...}} dispatcher={{...}} globalError={[...]}>
<DevOverlayErrorBoundary devOverlay={<ShadowPortal>} globalError={[...]} ...>
<DevRootHTTPAccessFallbackBoundary>
<HTTPAccessFallbackBoundary notFound={<NotAllowedRootHTTPFallbackError>}>
<HTTPAccessFallbackErrorBoundary pathname="/" notFound={<NotAllowedRootHTTPFallbackError>} ...>
......@@ -242,6 +245,7 @@ describe('Error overlay for hydration errors in App router', () => {
"...
<HotReload assetPrefix="" globalError={[...]}>
<ReactDevOverlay state={{nextId:1, ...}} dispatcher={{...}} globalError={[...]}>
<DevOverlayErrorBoundary devOverlay={<ShadowPortal>} globalError={[...]} ...>
<DevRootHTTPAccessFallbackBoundary>
<HTTPAccessFallbackBoundary notFound={<NotAllowedRootHTTPFallbackError>}>
<HTTPAccessFallbackErrorBoundary pathname="/" notFound={<NotAllowedRootHTTPFallbackError>} ...>
......@@ -796,7 +800,10 @@ describe('Error overlay for hydration errors in App router', () => {
await session.openRedbox()
await retry(async () => {
expect(await getRedboxTotalErrorCount(browser)).toBe(2)
expect(await getRedboxTotalErrorCount(browser)).toBe(
// With owner stacks, we also get an error for the parent context
enableOwnerStacks ? 3 : 2
)
})
const description = await session.getRedboxDescription()
......
......@@ -175,7 +175,7 @@ describe('Error overlay - RSC build errors', () => {
// TODO: fix the issue ordering.
// turbopack emits the resolve issue first instead of the transform issue.
expect(await session.getRedboxSource()).toMatchInlineSnapshot(`
"./app/server-with-errors/client-only-in-server/client-only-lib.js:1:1
"./app/server-with-errors/client-only-in-server/client-only-lib.js (1:1)
Ecmascript file had an error
> 1 | import 'client-only'
| ^^^^^^^^^^^^^^^^^^^^
......@@ -348,7 +348,7 @@ describe('Error overlay - RSC build errors', () => {
if (process.env.TURBOPACK) {
expect(next.normalizeTestDirContent(await session.getRedboxSource()))
.toMatchInlineSnapshot(`
"./app/server-with-errors/error-file/error.js:1:1
"./app/server-with-errors/error-file/error.js (1:1)
Ecmascript file had an error
> 1 | export default function Error() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
......
......@@ -8,6 +8,9 @@ import {
getVersionCheckerText,
} from 'next-test-utils'
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
describe('Error overlay - RSC runtime errors', () => {
const { next } = nextTestSetup({
files: new FileRef(path.join(__dirname, 'fixtures', 'rsc-runtime-errors')),
......@@ -108,7 +111,11 @@ describe('Error overlay - RSC runtime errors', () => {
await assertHasRedbox(browser)
const versionText = await getVersionCheckerText(browser)
if (isNewDevOverlay) {
expect(versionText).toMatch(/Next.js [\w.-]+/)
} else {
expect(versionText).toMatch(/Next.js \([\w.-]+\)/)
}
})
it('should not show the bundle layer info in the file trace', async () => {
......
......@@ -11,6 +11,9 @@ function getStaleness(browser: BrowserInterface) {
.text()
}
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
describe('Error Overlay version staleness', () => {
const { next } = nextTestSetup({
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
......@@ -47,6 +50,20 @@ describe('Error Overlay version staleness', () => {
await session.openRedbox()
if (isNewDevOverlay) {
if (process.env.TURBOPACK) {
expect(await getStaleness(browser)).toMatchInlineSnapshot(`
"Next.js 1.0.0 (outdated)
(learn more)
Turbopack"
`)
} else {
expect(await getStaleness(browser)).toMatchInlineSnapshot(`
"Next.js 1.0.0 (outdated)
(learn more)"
`)
}
} else {
if (process.env.TURBOPACK) {
expect(await getStaleness(browser)).toMatchInlineSnapshot(
`"Next.js (1.0.0) is outdated (learn more) (Turbopack)"`
......@@ -56,6 +73,7 @@ describe('Error Overlay version staleness', () => {
`"Next.js (1.0.0) is outdated (learn more)"`
)
}
}
})
it('should show version staleness in render error', async () => {
......@@ -83,13 +101,16 @@ describe('Error Overlay version staleness', () => {
)
if (process.env.TURBOPACK) {
expect(await getStaleness(browser)).toMatchInlineSnapshot(
`"Next.js (2.0.0) is outdated (learn more) (Turbopack)"`
)
expect(await getStaleness(browser)).toMatchInlineSnapshot(`
"Next.js 2.0.0 (outdated)
(learn more)
Turbopack"
`)
} else {
expect(await getStaleness(browser)).toMatchInlineSnapshot(
`"Next.js (2.0.0) is outdated (learn more)"`
)
expect(await getStaleness(browser)).toMatchInlineSnapshot(`
"Next.js 2.0.0 (outdated)
(learn more)"
`)
}
})
......@@ -115,13 +136,16 @@ describe('Error Overlay version staleness', () => {
)
if (process.env.TURBOPACK) {
expect(await getStaleness(browser)).toMatchInlineSnapshot(
`"Next.js (3.0.0) is outdated (learn more) (Turbopack)"`
)
expect(await getStaleness(browser)).toMatchInlineSnapshot(`
"Next.js 3.0.0 (outdated)
(learn more)
Turbopack"
`)
} else {
expect(await getStaleness(browser)).toMatchInlineSnapshot(
`"Next.js (3.0.0) is outdated (learn more)"`
)
expect(await getStaleness(browser)).toMatchInlineSnapshot(`
"Next.js 3.0.0 (outdated)
(learn more)"
`)
}
})
})
......@@ -97,7 +97,7 @@ describe.each(['default', 'turbo'])(
const source = next.normalizeTestDirContent(content)
if (process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(`
"./pages/_app.js:2:11
"./pages/_app.js (2:11)
Parsing ecmascript source code failed
1 | function MyApp({ Component, pageProps }) {
> 2 | return <<Component {...pageProps} />;
......@@ -184,7 +184,7 @@ describe.each(['default', 'turbo'])(
)
if (process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(`
"./pages/_document.js:3:36
"./pages/_document.js (3:36)
Parsing ecmascript source code failed
1 | import Document, { Html, Head, Main, NextScript } from 'next/document'
2 |
......
......@@ -47,7 +47,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
await session.assertHasRedbox()
if (process.env.TURBOPACK) {
expect(await session.getRedboxSource()).toMatchInlineSnapshot(`
"./node_modules/my-package/index.js:1:13
"./node_modules/my-package/index.js (1:13)
Module not found: Can't resolve 'dns'
> 1 | const dns = require('dns')
| ^^^^^^^^^^^^^^
......@@ -57,7 +57,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
`)
} else {
expect(await session.getRedboxSource()).toMatchInlineSnapshot(`
"./node_modules/my-package/index.js:1:1
"./node_modules/my-package/index.js (1:1)
Module not found: Can't resolve 'dns'
> 1 | const dns = require('dns')
| ^
......@@ -96,7 +96,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
const source = await session.getRedboxSource()
if (process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(`
"./index.js:1:1
"./index.js (1:1)
Module not found: Can't resolve 'b'
> 1 | import Comp from 'b'
| ^^^^^^^^^^^^^^^^^^^^
......@@ -108,7 +108,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
`)
} else {
expect(source).toMatchInlineSnapshot(`
"./index.js:1:1
"./index.js (1:1)
Module not found: Can't resolve 'b'
> 1 | import Comp from 'b'
| ^
......@@ -148,7 +148,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
const source = await session.getRedboxSource()
if (process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(`
"./pages/index.js:1:1
"./pages/index.js (1:1)
Module not found: Can't resolve 'b'
> 1 | import Comp from 'b'
| ^^^^^^^^^^^^^^^^^^^^
......@@ -160,7 +160,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
`)
} else {
expect(source).toMatchInlineSnapshot(`
"./pages/index.js:1:1
"./pages/index.js (1:1)
Module not found: Can't resolve 'b'
> 1 | import Comp from 'b'
| ^
......@@ -203,7 +203,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
const source = await session.getRedboxSource()
if (process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(`
"./pages/_app.js:1:1
"./pages/_app.js (1:1)
Module not found: Can't resolve './non-existent.css'
> 1 | import './non-existent.css'
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
......@@ -215,7 +215,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
`)
} else {
expect(source).toMatchInlineSnapshot(`
"./pages/_app.js:1:1
"./pages/_app.js (1:1)
Module not found: Can't resolve './non-existent.css'
> 1 | import './non-existent.css'
| ^
......
......@@ -213,7 +213,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
const source = next.normalizeTestDirContent(await session.getRedboxSource())
if (process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(`
"./index.js:7:1
"./index.js (7:1)
Parsing ecmascript source code failed
5 | div
6 | )
......@@ -345,8 +345,8 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
const source = await session.getRedboxSource()
expect(source).toMatch(
process.env.TURBOPACK
? './index.module.css:1:9'
: './index.module.css:1:1'
? './index.module.css (1:9)'
: './index.module.css (1:1)'
)
if (!process.env.TURBOPACK) {
expect(source).toMatch('Syntax error: ')
......
......@@ -284,7 +284,8 @@ describe('ReactRefreshRegression', () => {
await session.assertHasRedbox()
const source = await session.getRedboxSource()
expect(source.split(/\r?\n/g).slice(2).join('\n')).toMatchInlineSnapshot(`
expect(source.split(/\r?\n/g).slice(2).join('\n').replace(/^\n+/, ''))
.toMatchInlineSnapshot(`
"> 1 | export default function () { throw new Error('boom'); }
| ^"
`)
......
......@@ -19,7 +19,7 @@ exports[`ReactRefreshLogBox default conversion to class component (1) 1`] = `
`;
exports[`ReactRefreshLogBox default css syntax errors 1`] = `
"./index.module.css:1: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 {}
......
......@@ -437,7 +437,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
if (isTurbopack) {
// TODO: Remove this branching once import traces are implemented in Turbopack
expect(redboxSource).toMatchInlineSnapshot(`
"./index.js:7:41
"./index.js (7:41)
Parsing ecmascript source code failed
5 | throw Error('no ' + i)
6 | }, 1000)
......@@ -474,7 +474,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
if (isTurbopack) {
// TODO: Remove this branching once import traces are implemented in Turbopack
expect(redboxSource).toMatchInlineSnapshot(`
"./index.js:7:41
"./index.js (7:41)
Parsing ecmascript source code failed
5 | throw Error('no ' + i)
6 | }, 1000)
......
/* eslint-env jest */
import { createSandbox } from 'development-sandbox'
import { FileRef, nextTestSetup } from 'e2e-utils'
import path from 'path'
......@@ -6,6 +5,9 @@ import { outdent } from 'outdent'
import { getRedboxTotalErrorCount, retry } from 'next-test-utils'
const isReact18 = parseInt(process.env.NEXT_TEST_REACT_VERSION) === 18
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
// https://github.com/facebook/react/blob/main/packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js used as a reference
describe('Error overlay for hydration errors in Pages router', () => {
......@@ -123,7 +125,7 @@ describe('Error overlay for hydration errors in Pages router', () => {
<AppContainer>
<Container fn={function fn}>
<ReactDevOverlay>
<ErrorBoundary onError={function usePagesReactDevOverlay.useCallback[onComponentError]}>
<DevOverlayErrorBoundary onError={function usePagesReactDevOverlay.useCallback[onComponentError]}>
<PathnameContextProviderAdapter router={{sdc:{},sbc:{}, ...}} isAutoExport={true}>
<App pageProps={{}} Component={function Mismatch} err={undefined} router={{sdc:{},sbc:{}, ...}}>
<Mismatch>
......@@ -131,6 +133,7 @@ describe('Error overlay for hydration errors in Pages router', () => {
<main className="child">
+ client
- server
...
..."
`)
}
......@@ -192,12 +195,13 @@ describe('Error overlay for hydration errors in Pages router', () => {
<AppContainer>
<Container fn={function fn}>
<ReactDevOverlay>
<ErrorBoundary onError={function usePagesReactDevOverlay.useCallback[onComponentError]}>
<DevOverlayErrorBoundary onError={function usePagesReactDevOverlay.useCallback[onComponentError]}>
<PathnameContextProviderAdapter router={{sdc:{},sbc:{}, ...}} isAutoExport={true}>
<App pageProps={{}} Component={function Mismatch} err={undefined} router={{sdc:{},sbc:{}, ...}}>
<Mismatch>
<div className="parent">
+ <main className="only">
...
..."
`)
}
......@@ -256,7 +260,7 @@ describe('Error overlay for hydration errors in Pages router', () => {
<AppContainer>
<Container fn={function fn}>
<ReactDevOverlay>
<ErrorBoundary onError={function usePagesReactDevOverlay.useCallback[onComponentError]}>
<DevOverlayErrorBoundary onError={function usePagesReactDevOverlay.useCallback[onComponentError]}>
<PathnameContextProviderAdapter router={{sdc:{},sbc:{}, ...}} isAutoExport={true}>
<App pageProps={{}} Component={function Mismatch} err={undefined} router={{sdc:{},sbc:{}, ...}}>
<Mismatch>
......@@ -265,6 +269,7 @@ describe('Error overlay for hydration errors in Pages router', () => {
+ second
- <footer className="3">
...
...
..."
`)
}
......@@ -316,12 +321,13 @@ describe('Error overlay for hydration errors in Pages router', () => {
<AppContainer>
<Container fn={function fn}>
<ReactDevOverlay>
<ErrorBoundary onError={function usePagesReactDevOverlay.useCallback[onComponentError]}>
<DevOverlayErrorBoundary onError={function usePagesReactDevOverlay.useCallback[onComponentError]}>
<PathnameContextProviderAdapter router={{sdc:{},sbc:{}, ...}} isAutoExport={true}>
<App pageProps={{}} Component={function Mismatch} err={undefined} router={{sdc:{},sbc:{}, ...}}>
<Mismatch>
<div className="parent">
- <main className="only">
...
..."
`)
}
......@@ -382,12 +388,13 @@ describe('Error overlay for hydration errors in Pages router', () => {
<AppContainer>
<Container fn={function fn}>
<ReactDevOverlay>
<ErrorBoundary onError={function usePagesReactDevOverlay.useCallback[onComponentError]}>
<DevOverlayErrorBoundary onError={function usePagesReactDevOverlay.useCallback[onComponentError]}>
<PathnameContextProviderAdapter router={{sdc:{},sbc:{}, ...}} isAutoExport={true}>
<App pageProps={{}} Component={function Mismatch} err={undefined} router={{sdc:{},sbc:{}, ...}}>
<Mismatch>
<div className="parent">
- only
...
..."
`)
}
......@@ -449,12 +456,13 @@ describe('Error overlay for hydration errors in Pages router', () => {
<AppContainer>
<Container fn={function fn}>
<ReactDevOverlay>
<ErrorBoundary onError={function usePagesReactDevOverlay.useCallback[onComponentError]}>
<DevOverlayErrorBoundary onError={function usePagesReactDevOverlay.useCallback[onComponentError]}>
<PathnameContextProviderAdapter router={{sdc:{},sbc:{}, ...}} isAutoExport={true}>
<App pageProps={{}} Component={function Page} err={undefined} router={{sdc:{},sbc:{}, ...}}>
<Page>
+ <table>
- test
...
..."
`)
}
......@@ -480,7 +488,11 @@ describe('Error overlay for hydration errors in Pages router', () => {
])
)
const { session, browser } = sandbox
// in the new overlay, `assertHasRedbox` is redundant with `hasErrorToast`
if (!isNewDevOverlay) {
await expect(session.hasErrorToast()).resolves.toBe(false)
}
await session.assertHasRedbox()
......@@ -509,12 +521,13 @@ describe('Error overlay for hydration errors in Pages router', () => {
<AppContainer>
<Container fn={function fn}>
<ReactDevOverlay>
<ErrorBoundary onError={function usePagesReactDevOverlay.useCallback[onComponentError]}>
<DevOverlayErrorBoundary onError={function usePagesReactDevOverlay.useCallback[onComponentError]}>
<PathnameContextProviderAdapter router={{sdc:{},sbc:{}, ...}} isAutoExport={true}>
<App pageProps={{}} Component={function Page} err={undefined} router={{sdc:{},sbc:{}, ...}}>
<Page>
+ <table>
- {" 123"}
...
..."
`)
} else {
......@@ -524,12 +537,13 @@ describe('Error overlay for hydration errors in Pages router', () => {
<AppContainer>
<Container fn={function fn}>
<ReactDevOverlay>
<ErrorBoundary onError={function usePagesReactDevOverlay.useCallback[onComponentError]}>
<DevOverlayErrorBoundary onError={function usePagesReactDevOverlay.useCallback[onComponentError]}>
<PathnameContextProviderAdapter router={{sdc:{},sbc:{}, ...}} isAutoExport={true}>
<App pageProps={{}} Component={function Page} err={undefined} router={{sdc:{},sbc:{}, ...}}>
<Page>
+ <table>
- {" 123"}
...
..."
`)
}
......@@ -575,7 +589,7 @@ describe('Error overlay for hydration errors in Pages router', () => {
expect(pseudoHtml).toMatchInlineSnapshot(`
"...
<ReactDevOverlay>
<ErrorBoundary onError={function usePagesReactDevOverlay.useCallback[onComponentError]}>
<DevOverlayErrorBoundary onError={function usePagesReactDevOverlay.useCallback[onComponentError]}>
<PathnameContextProviderAdapter router={{sdc:{},sbc:{}, ...}} isAutoExport={true}>
<App pageProps={{}} Component={function Mismatch} err={undefined} router={{sdc:{},sbc:{}, ...}}>
<Mismatch>
......@@ -585,6 +599,7 @@ describe('Error overlay for hydration errors in Pages router', () => {
+ <main className="second">
- <footer className="3">
...
...
..."
`)
}
......@@ -685,12 +700,13 @@ describe('Error overlay for hydration errors in Pages router', () => {
<AppContainer>
<Container fn={function fn}>
<ReactDevOverlay>
<ErrorBoundary onError={function usePagesReactDevOverlay.useCallback[onComponentError]}>
<DevOverlayErrorBoundary onError={function usePagesReactDevOverlay.useCallback[onComponentError]}>
<PathnameContextProviderAdapter router={{sdc:{},sbc:{}, ...}} isAutoExport={true}>
<App pageProps={{}} Component={function Page} err={undefined} router={{sdc:{},sbc:{}, ...}}>
<Page>
> <p>
> <p>
...
..."
`)
}
......@@ -751,7 +767,7 @@ describe('Error overlay for hydration errors in Pages router', () => {
"...
<Container fn={function fn}>
<ReactDevOverlay>
<ErrorBoundary onError={function usePagesReactDevOverlay.useCallback[onComponentError]}>
<DevOverlayErrorBoundary onError={function usePagesReactDevOverlay.useCallback[onComponentError]}>
<PathnameContextProviderAdapter router={{sdc:{},sbc:{}, ...}} isAutoExport={true}>
<App pageProps={{}} Component={function Page} err={undefined} router={{sdc:{},sbc:{}, ...}}>
<Page>
......@@ -759,6 +775,7 @@ describe('Error overlay for hydration errors in Pages router', () => {
<div>
> <p>
> <div>
...
..."
`)
}
......@@ -811,12 +828,13 @@ describe('Error overlay for hydration errors in Pages router', () => {
<AppContainer>
<Container fn={function fn}>
<ReactDevOverlay>
<ErrorBoundary onError={function usePagesReactDevOverlay.useCallback[onComponentError]}>
<DevOverlayErrorBoundary onError={function usePagesReactDevOverlay.useCallback[onComponentError]}>
<PathnameContextProviderAdapter router={{sdc:{},sbc:{}, ...}} isAutoExport={true}>
<App pageProps={{}} Component={function Page} err={undefined} router={{sdc:{},sbc:{}, ...}}>
<Page>
> <div>
> <tr>
...
..."
`)
}
......@@ -875,7 +893,7 @@ describe('Error overlay for hydration errors in Pages router', () => {
<AppContainer>
<Container fn={function fn}>
<ReactDevOverlay>
<ErrorBoundary onError={function usePagesReactDevOverlay.useCallback[onComponentError]}>
<DevOverlayErrorBoundary onError={function usePagesReactDevOverlay.useCallback[onComponentError]}>
<PathnameContextProviderAdapter router={{sdc:{},sbc:{}, ...}} isAutoExport={true}>
<App pageProps={{}} Component={function Page} err={undefined} router={{sdc:{},sbc:{}, ...}}>
<Page>
......@@ -885,6 +903,7 @@ describe('Error overlay for hydration errors in Pages router', () => {
<span>
<span>
> <p>
...
..."
`)
}
......
......@@ -52,7 +52,7 @@ describe('Error Overlay for server components compiler errors in pages', () => {
if (process.env.TURBOPACK) {
expect(next.normalizeTestDirContent(await session.getRedboxSource()))
.toMatchInlineSnapshot(`
"./components/Comp.js:1:1
"./components/Comp.js (1:1)
Ecmascript file had an error
> 1 | import { cookies } from 'next/headers'
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
......@@ -108,7 +108,7 @@ describe('Error Overlay for server components compiler errors in pages', () => {
if (process.env.TURBOPACK) {
expect(next.normalizeTestDirContent(await session.getRedboxSource()))
.toMatchInlineSnapshot(`
"./components/Comp.js:1:1
"./components/Comp.js (1:1)
Ecmascript file had an error
> 1 | import 'server-only'
| ^^^^^^^^^^^^^^^^^^^^
......@@ -166,7 +166,7 @@ describe('Error Overlay for server components compiler errors in pages', () => {
if (process.env.TURBOPACK) {
expect(next.normalizeTestDirContent(await session.getRedboxSource()))
.toMatchInlineSnapshot(`
"./components/Comp.js:1:10
"./components/Comp.js (1:10)
Ecmascript file had an error
> 1 | import { after } from 'next/server'
| ^^^^^
......
......@@ -34,8 +34,8 @@ describe('app-dir - capture-console-error', () => {
files: __dirname,
})
if (process.env.__NEXT_EXPERIMENTAL_PPR === 'true') {
it('skip test for experimental PPR', () => {
if (process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true') {
it('skip test for new overlay', () => {
// Cover these tests in the owner stack tests suite
})
return
......
......@@ -11,9 +11,8 @@ describe('error-ignored-frames', () => {
})
if (
// TODO: remove this when reactOwnerStack is enabled by default
// Since PPR mode is just going to add owner stack, skip this test for now
process.env.__NEXT_EXPERIMENTAL_PPR === 'true' ||
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true' ||
// Skip react 18 test as the call stacks are different
process.env.NEXT_TEST_REACT_VERSION === '18.3.1'
) {
......
......@@ -9,9 +9,12 @@ import {
} from 'next-test-utils'
import { outdent } from 'outdent'
// TODO: merge with test/development/app-dir/missing-required-html-tags/index.test.ts
// TODO(new-dev-overlay): merge with test/development/app-dir/missing-required-html-tags/index.test.ts
// once new overlay is stable
describe('app-dir - missing required html tags', () => {
const isDisabled = process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'false'
;(isDisabled ? describe.skip : describe)(
'app-dir - missing required html tags',
() => {
const { next } = nextTestSetup({
files: __dirname,
})
......@@ -44,4 +47,5 @@ describe('app-dir - missing required html tags', () => {
await assertNoRedbox(browser)
expect(await browser.elementByCss('p').text()).toBe('hello world')
})
})
}
)
......@@ -7,8 +7,10 @@ import {
getStackFramesContent,
} from 'next-test-utils'
// TODO: When owner stack is enabled by default, remove the condition and only keep one test
const isOwnerStackEnabled = process.env.__NEXT_EXPERIMENTAL_PPR === 'true'
// TODO(new-dev-overlay): When owner stack is enabled by default, remove the condition and only keep one test
const isOwnerStackEnabled =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true' ||
process.env.__NEXT_EXPERIMENTAL_PPR === 'true'
;(isOwnerStackEnabled ? describe.skip : describe)(
'app-dir - invalid-element-type',
......
......@@ -5,10 +5,10 @@ import {
getStackFramesContent,
} from 'next-test-utils'
// TODO: When owner stack is enabled by default, remove the condition and only keep one test
// TODO(new-dev-overlay): When owner stack is enabled by default, remove the condition and only keep one test
const isOwnerStackEnabled =
process.env.TEST_OWNER_STACK !== 'false' ||
process.env.__NEXT_EXPERIMENTAL_PPR === 'true'
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
;(isOwnerStackEnabled ? describe : describe.skip)(
'app-dir - owner-stack-invalid-element-type',
......
......@@ -5,10 +5,12 @@ import {
getStackFramesContent,
} from 'next-test-utils'
// TODO: When owner stack is enabled by default, remove the condition and only keep one test
const isOwnerStackEnabled = process.env.__NEXT_EXPERIMENTAL_PPR === 'true'
// TODO(new-dev-overlay): When owner stack is enabled by default, remove the condition and only keep one test
const isExperimentalReact =
process.env.__NEXT_EXPERIMENTAL_PPR === 'true' ||
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
;(isOwnerStackEnabled ? describe : describe.skip)(
;(isExperimentalReact ? describe : describe.skip)(
'app-dir - owner-stack-react-missing-key-prop',
() => {
const { next } = nextTestSetup({
......@@ -24,7 +26,7 @@ const isOwnerStackEnabled = process.env.__NEXT_EXPERIMENTAL_PPR === 'true'
if (process.env.TURBOPACK) {
expect(stackFramesContent).toMatchInlineSnapshot(`
"at span (<anonymous> (0:0))
"at span ()
at <anonymous> (app/rsc/page.tsx (7:10))
at Page (app/rsc/page.tsx (6:13))"
`)
......@@ -67,9 +69,9 @@ const isOwnerStackEnabled = process.env.__NEXT_EXPERIMENTAL_PPR === 'true'
const source = await getRedboxSource(browser)
if (process.env.TURBOPACK) {
expect(stackFramesContent).toMatchInlineSnapshot(`
"at p (<anonymous> (0:0))
"at p ()
at <unknown> (app/ssr/page.tsx (9:9))
at Array.map (<anonymous> (0:0))
at Array.map ()
at Page (app/ssr/page.tsx (8:13))"
`)
expect(source).toMatchInlineSnapshot(`
......
......@@ -5,8 +5,10 @@ import {
hasRedboxCallStack,
} from 'next-test-utils'
// TODO: When owner stack is enabled by default, remove the condition and only keep one test
const isOwnerStackEnabled = process.env.__NEXT_EXPERIMENTAL_PPR === 'true'
// TODO(new-dev-overlay): When owner stack is enabled by default, remove the condition and only keep one test
const isExperimentalReact =
process.env.__NEXT_EXPERIMENTAL_PPR === 'true' ||
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
async function getStackFramesContent(browser) {
await hasRedboxCallStack(browser)
......@@ -37,7 +39,7 @@ async function getStackFramesContent(browser) {
}
// Without owner stack, the source is not available
;(isOwnerStackEnabled ? describe.skip : describe)(
;(isExperimentalReact ? describe.skip : describe)(
'app-dir - react-missing-key-prop',
() => {
const { next } = nextTestSetup({
......
......@@ -71,7 +71,7 @@ describe('app-dir - owner-stack', () => {
return log.message.includes('Error: browser error')
}).message
// TODO(jiwon): Remove this once we have a new dev overlay at stable.
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
if (isNewDevOverlay) {
if (process.env.TURBOPACK) {
expect(normalizeStackTrace(errorLog)).toMatchInlineSnapshot(`
......@@ -130,7 +130,7 @@ describe('app-dir - owner-stack', () => {
at renderRootSync
at performWorkOnRoot
at performWorkOnRootViaSchedulerTask
at MessagePort.performWorkUntilDeadline The above error occurred in the <Page> component. It was handled by the <ReactDevOverlay> error boundary."
at MessagePort.performWorkUntilDeadline The above error occurred in the <Page> component. It was handled by the <DevOverlayErrorBoundary> error boundary."
`)
} else {
expect(normalizeStackTrace(errorLog)).toMatchInlineSnapshot(`
......
......@@ -5,7 +5,7 @@ import {
getRedboxSource,
} from 'next-test-utils'
// Enabling PPR testing also enables the new dev overlay.
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
......@@ -24,12 +24,11 @@ describe('app-dir - server-component-next-dynamic-ssr-false', () => {
expect(redbox.description).toBe('Failed to compile')
// TODO(jiwon): Remove this once we have a new dev overlay at stable.
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
if (isNewDevOverlay) {
if (process.env.TURBOPACK) {
expect(redbox.source).toMatchInlineSnapshot(`
"./app/page.js (3:23)
Ecmascript file had an error
1 | import dynamic from 'next/dynamic'
2 |
......@@ -59,7 +58,7 @@ describe('app-dir - server-component-next-dynamic-ssr-false', () => {
} else {
if (process.env.TURBOPACK) {
expect(redbox.source).toMatchInlineSnapshot(`
"./app/page.js:3:23
"./app/page.js (3:23)
Ecmascript file had an error
1 | import dynamic from 'next/dynamic'
2 |
......
......@@ -7,8 +7,11 @@ import {
getRedboxSource,
} from 'next-test-utils'
const isReactExperimental = process.env.__NEXT_EXPERIMENTAL_PPR === 'true'
const isNewDevOverlay = isReactExperimental
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
const isReactExperimental =
process.env.__NEXT_EXPERIMENTAL_PPR === 'true' || isNewDevOverlay
const isReact18 = parseInt(process.env.NEXT_TEST_REACT_VERSION) === 18
describe('react-dom/server in React Server environment', () => {
......@@ -284,7 +287,7 @@ describe('react-dom/server in React Server environment', () => {
expect(redbox).toMatchInlineSnapshot(`
{
"description": "Failed to compile",
"source": "./app/exports/app-code/react-dom-server-edge-implicit/page.js:3:1
"source": "./app/exports/app-code/react-dom-server-edge-implicit/page.js (3:1)
Ecmascript file had an error
1 | import * as ReactDOMServerEdge from 'react-dom/server'
2 | // Fine to drop once React is on ESM
......@@ -379,7 +382,7 @@ describe('react-dom/server in React Server environment', () => {
expect(redbox).toMatchInlineSnapshot(`
{
"description": "Failed to compile",
"source": "./app/exports/app-code/react-dom-server-node-implicit/page.js:3:1
"source": "./app/exports/app-code/react-dom-server-node-implicit/page.js (3:1)
Ecmascript file had an error
1 | import * as ReactDOMServerNode from 'react-dom/server'
2 | // Fine to drop once React is on ESM
......@@ -394,7 +397,7 @@ describe('react-dom/server in React Server environment', () => {
}
`)
} else {
// TODO(jiwon): Remove this once we have a new dev overlay at stable.
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
if (isNewDevOverlay) {
expect(redbox).toMatchInlineSnapshot(`
{
......
......@@ -11,7 +11,23 @@ import {
} from 'next-test-utils'
import { NextInstance } from 'e2e-utils'
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
const installCheckVisible = (browser) => {
if (isNewDevOverlay) {
return browser.eval(`(function() {
window.checkInterval = setInterval(function() {
const root = document.querySelector('nextjs-portal').shadowRoot;
const indicator = root.querySelector('[data-next-mark]')
window.showedBuilder = window.showedBuilder || (
indicator.getAttribute('data-next-mark-loading') === 'true'
)
if (window.showedBuilder) clearInterval(window.checkInterval)
}, 50)
})()`)
} else {
return browser.eval(`(function() {
window.checkInterval = setInterval(function() {
let watcherDiv = document.querySelector('#__next-build-indicator')
......@@ -22,6 +38,7 @@ const installCheckVisible = (browser) => {
if (window.showedBuilder) clearInterval(window.checkInterval)
}, 50)
})()`)
}
}
describe('GS(S)P Server-Side Change Reloading', () => {
......
......@@ -195,7 +195,7 @@ describe.each([
`)
} else if (basePath === '' && process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(`
"./pages/hmr/about2.js:7:1
"./pages/hmr/about2.js (7:1)
Parsing ecmascript source code failed
5 | div
6 | )
......@@ -231,7 +231,7 @@ describe.each([
`)
} else if (basePath === '/docs' && process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(`
"./pages/hmr/about2.js:7:1
"./pages/hmr/about2.js (7:1)
Parsing ecmascript source code failed
5 | div
6 | )
......@@ -594,7 +594,7 @@ describe.each([
if (process.env.TURBOPACK) {
expect(next.normalizeTestDirContent(redboxSource))
.toMatchInlineSnapshot(`
"./components/parse-error.js:3:1
"./components/parse-error.js (3:1)
Parsing ecmascript source code failed
1 | This
2 | is
......
......@@ -29,12 +29,16 @@ describe('client-dev-overlay', () => {
const selectors = {
fullScreenDialog: '[data-nextjs-dialog]',
toast: '[data-nextjs-toast]',
minimizeButton: '[data-nextjs-errors-dialog-left-right-close-button]',
hideButton: '[data-nextjs-toast-errors-hide-button]',
popover: '[data-nextjs-dev-tools-button]',
minimizeButton: 'body',
hideButton: '[data-hide-dev-tools]',
}
function getToast() {
return browser.elementByCss(selectors.toast)
}
function getPopover() {
return browser.elementByCss(selectors.popover)
}
function getMinimizeButton() {
return browser.elementByCss(selectors.minimizeButton)
}
......@@ -64,10 +68,11 @@ describe('client-dev-overlay', () => {
it('should be able to hide the minimized overlay', async () => {
await getMinimizeButton().click()
await getPopover().click()
await getHideButton().click()
await check(async () => {
const exists = await elementExistsInNextJSPortalShadowDOM('div')
const exists = await elementExistsInNextJSPortalShadowDOM(selectors.toast)
return exists ? 'found' : 'success'
}, 'success')
})
......
......@@ -41,7 +41,7 @@ export default withRouter(
render() {
return (
<div className="shallow-routing">
<div className="shallow-routing" style={{ paddingBottom: 60 }}>
<Link href="/nav" id="home-link" style={linkStyle}>
Home
</Link>
......
......@@ -26,7 +26,7 @@ describe('app dir - css', () => {
// css-loader does not report an error for this case
expect(source).toMatchInlineSnapshot(`
"./app/global.scss.css:45:1
"./app/global.scss.css (45:1)
Parsing css source code failed
43 | }
44 |
......
......@@ -25,8 +25,12 @@ describe('dynamic-io', () => {
expect(await browser.elementByCss('p').text()).toBe('result')
})
if (process.env.__NEXT_EXPERIMENTAL_PPR && isNextDev) {
// TODO(react-time-info): Remove this branch for PPR in dev mode when the
if (
(process.env.__NEXT_EXPERIMENTAL_PPR ||
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY) &&
isNextDev
) {
// TODO(react-time-info): Remove this branch for experimental React in dev mode when the
// issue is resolved where the inclusion of server timings in the RSC
// payload makes the serialized bound args not suitable to be used as a
// cache key.
......
......@@ -19,14 +19,15 @@ describe('dynamic-io', () => {
if (isNextDev && !WITH_PPR) {
async function hasStaticIndicator(browser: BrowserInterface) {
const staticIndicatorPresent = await browser.eval(() =>
Boolean(
await browser.elementByCss('[data-nextjs-dev-tools-button]').click()
return await browser.eval(
() =>
document
.querySelector('nextjs-portal')
.shadowRoot.querySelector('.nextjs-static-indicator-toast-wrapper')
)
.shadowRoot.querySelector('[data-nextjs-route-type]')
.getAttribute('data-nextjs-route-type') === 'static'
)
return staticIndicatorPresent
}
it('should not have static indicator on dynamic method route', async () => {
......
......@@ -26,12 +26,11 @@ describe('app-dir - error-on-next-codemod-comment', () => {
await assertHasRedbox(browser)
// TODO(jiwon): Remove this once we have a new dev overlay at stable.
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
if (isNewDevOverlay) {
if (process.env.TURBOPACK) {
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
"./app/page.tsx (2:2)
Ecmascript file had an error
1 | export default function Page() {
> 2 | // @next-codemod-error remove jsx of next line
......@@ -62,7 +61,7 @@ describe('app-dir - error-on-next-codemod-comment', () => {
} else {
if (process.env.TURBOPACK) {
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
"./app/page.tsx:2:2
"./app/page.tsx (2:2)
Ecmascript file had an error
1 | export default function Page() {
> 2 | // @next-codemod-error remove jsx of next line
......
/* eslint-env jest */
import { nextTestSetup } from 'e2e-utils'
import { retry } from 'next-test-utils'
import { createProxyServer } from 'next/experimental/testmode/proxy'
......@@ -8,8 +7,12 @@ import * as Log from './utils/log'
const runtimes = ['nodejs', 'edge']
const isReactExperimental =
process.env.__NEXT_EXPERIMENTAL_PPR === 'true' ||
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
describe.each(runtimes)('after() in %s runtime', (runtimeValue) => {
const { next, isNextDeploy, skipped } = nextTestSetup({
const { next, isNextDeploy, skipped, isTurbopack } = nextTestSetup({
files: __dirname,
// `patchFile` and reading runtime logs are not supported in a deployed environment
skipDeployment: true,
......@@ -98,7 +101,12 @@ describe.each(runtimes)('after() in %s runtime', (runtimeValue) => {
})
describe('interrupted RSC renders', () => {
it('runs callbacks if redirect() was called', async () => {
// This is currently broken with experimental React & Turbopack
// https://github.com/vercel/next.js/pull/75989
;(isTurbopack && isReactExperimental ? it.skip : it)(
'runs callbacks if redirect() was called',
async () => {
await next.browser(pathPrefix + '/interrupted/calls-redirect')
await retry(() => {
......@@ -109,7 +117,8 @@ describe.each(runtimes)('after() in %s runtime', (runtimeValue) => {
source: '[page] /interrupted/redirect-target',
})
})
})
}
)
it('runs callbacks if notFound() was called', async () => {
await next.browser(pathPrefix + '/interrupted/calls-not-found')
......
......@@ -425,8 +425,10 @@ describe('app dir - rsc basics', () => {
})
// TODO: (PPR) remove once PPR is stable
// TODO(new-dev-overlay): remove once new dev overlay is stable
const bundledReactVersionPattern =
process.env.__NEXT_EXPERIMENTAL_PPR === 'true'
process.env.__NEXT_EXPERIMENTAL_PPR === 'true' ||
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
? '-experimental-'
: '-canary-'
......
......@@ -10,6 +10,13 @@ import {
} from 'next-test-utils'
import stripAnsi from 'strip-ansi'
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
const needsExperimentalReact =
process.env.__NEXT_EXPERIMENTAL_PPR || isNewDevOverlay
const expectedErrorMessage =
'Error: Filling a cache during prerender timed out, likely because request-specific arguments such as params, searchParams, cookies() or dynamic data were used inside "use cache".'
......@@ -192,8 +199,8 @@ describe('use-cache-hanging-inputs', () => {
const cliOutput = stripAnsi(next.cliOutput.slice(outputIndex))
if (process.env.__NEXT_EXPERIMENTAL_PPR) {
// TODO(react-time-info): Remove this branch for PPR when the issue is
if (needsExperimentalReact) {
// TODO(react-time-info): Remove this branch for experimental React when the issue is
// resolved where the inclusion of server timings in the RSC payload
// makes the serialized bound args not suitable to be used as a cache
// key.
......
......@@ -31,7 +31,7 @@ describe('use-cache-segment-configs', () => {
expect(description).toBe('Failed to compile')
expect(source).toMatchInlineSnapshot(`
"./app/runtime/page.tsx:1:14
"./app/runtime/page.tsx (1:14)
Ecmascript file had an error
> 1 | export const runtime = 'edge'
| ^^^^^^^
......
......@@ -90,12 +90,11 @@ describe('use-cache-unknown-cache-kind', () => {
expect(errorDescription).toBe('Failed to compile')
// TODO(jiwon): Remove this once we have a new dev overlay at stable.
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
if (isNewDevOverlay) {
if (isTurbopack) {
expect(errorSource).toMatchInlineSnapshot(`
"./app/page.tsx (1:1)
Ecmascript file had an error
> 1 | 'use cache: custom'
| ^^^^^^^^^^^^^^^^^^^
......@@ -122,7 +121,7 @@ describe('use-cache-unknown-cache-kind', () => {
} else {
if (isTurbopack) {
expect(errorSource).toMatchInlineSnapshot(`
"./app/page.tsx:1:1
"./app/page.tsx (1:1)
Ecmascript file had an error
> 1 | 'use cache: custom'
| ^^^^^^^^^^^^^^^^^^^
......
......@@ -89,12 +89,11 @@ describe('use-cache-without-experimental-flag', () => {
expect(errorDescription).toBe('Failed to compile')
// TODO(jiwon): Remove this once we have a new dev overlay at stable.
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
if (isNewDevOverlay) {
if (isTurbopack) {
expect(errorSource).toMatchInlineSnapshot(`
"./app/page.tsx (1:1)
Ecmascript file had an error
> 1 | 'use cache'
| ^^^^^^^^^^^
......@@ -125,7 +124,7 @@ describe('use-cache-without-experimental-flag', () => {
} else {
if (isTurbopack) {
expect(errorSource).toMatchInlineSnapshot(`
"./app/page.tsx:1:1
"./app/page.tsx (1:1)
Ecmascript file had an error
> 1 | 'use cache'
| ^^^^^^^^^^^
......
......@@ -11,7 +11,23 @@ const nextConfig = join(appDir, 'next.config.js')
let appPort
let app
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
const installCheckVisible = (browser) => {
if (isNewDevOverlay) {
return browser.eval(`(function() {
window.checkInterval = setInterval(function() {
const root = document.querySelector('nextjs-portal').shadowRoot;
const indicator = root.querySelector('[data-next-mark]')
window.showedBuilder = window.showedBuilder || (
indicator.getAttribute('data-next-mark-loading') === 'true'
)
if (window.showedBuilder) clearInterval(window.checkInterval)
}, 5)
})()`)
} else {
return browser.eval(`(function() {
window.checkInterval = setInterval(function() {
let watcherDiv = document.querySelector('#__next-build-indicator')
......@@ -22,6 +38,7 @@ const installCheckVisible = (browser) => {
if (window.showedBuilder) clearInterval(window.checkInterval)
}, 5)
})()`)
}
}
describe('Build Activity Indicator', () => {
......@@ -67,6 +84,9 @@ describe('Build Activity Indicator', () => {
})
afterAll(() => killApp(app))
// The indicator has no special container in the new dev overlay -
// it's rendered as part of the indicator logo
if (!isNewDevOverlay) {
it('Adds the build indicator container', async () => {
const browser = await webdriver(
appPort,
......@@ -76,6 +96,8 @@ describe('Build Activity Indicator', () => {
expect(html).toMatch(/__next-build-indicator/)
await browser.close()
})
}
;(process.env.TURBOPACK ? describe.skip : describe)('webpack only', () => {
it('Shows the build indicator when a page is built during navigation', async () => {
const browser = await webdriver(
......
import { nextTestSetup } from 'e2e-utils'
const isReact18 = parseInt(process.env.NEXT_TEST_REACT_VERSION) === 18
// TODO(new-dev-overlay): Remove this once new dev overlay is stable
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
describe('custom server', () => {
const { next } = nextTestSetup({
......@@ -23,10 +26,12 @@ describe('custom server', () => {
})
describe('with app dir', () => {
if (!isNewDevOverlay) {
it('should render app with react canary', async () => {
const $ = await next.render$(`/1`)
expect($('body').text()).toMatch(/app: .+-canary/)
})
}
it('should render pages with installed react', async () => {
const $ = await next.render$(`/2`)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment