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 @@ ...@@ -45,7 +45,11 @@
"jest/no-conditional-expect": "off", "jest/no-conditional-expect": "off",
"jest/valid-title": "off", "jest/valid-title": "off",
"jest/no-interpolation-in-snapshots": "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 } }, { "files": ["**/__tests__/**"], "env": { "jest": true } },
......
...@@ -581,7 +581,7 @@ jobs: ...@@ -581,7 +581,7 @@ jobs:
uses: ./.github/workflows/build_reusable.yml uses: ./.github/workflows/build_reusable.yml
with: with:
nodeVersion: 18.18.2 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' stepName: 'test-ppr-integration'
secrets: inherit secrets: inherit
...@@ -596,7 +596,7 @@ jobs: ...@@ -596,7 +596,7 @@ jobs:
group: [1/6, 2/6, 3/6, 4/6, 5/6, 6/6] group: [1/6, 2/6, 3/6, 4/6, 5/6, 6/6]
uses: ./.github/workflows/build_reusable.yml uses: ./.github/workflows/build_reusable.yml
with: 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 }}' stepName: 'test-ppr-dev-${{ matrix.group }}'
secrets: inherit secrets: inherit
...@@ -611,7 +611,7 @@ jobs: ...@@ -611,7 +611,7 @@ jobs:
group: [1/7, 2/7, 3/7, 4/7, 5/7, 6/7, 7/7] group: [1/7, 2/7, 3/7, 4/7, 5/7, 6/7, 7/7]
uses: ./.github/workflows/build_reusable.yml uses: ./.github/workflows/build_reusable.yml
with: 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 }}' stepName: 'test-ppr-prod-${{ matrix.group }}'
secrets: inherit secrets: inherit
......
...@@ -262,6 +262,7 @@ function DevToolsPopover({ ...@@ -262,6 +262,7 @@ function DevToolsPopover({
<div className="footer"> <div className="footer">
<MenuItem <MenuItem
data-hide-dev-tools
label="Hide Dev Tools" label="Hide Dev Tools"
value={<HideShortcut />} value={<HideShortcut />}
onClick={hide} onClick={hide}
......
...@@ -415,6 +415,7 @@ export const NextLogo = forwardRef(function NextLogo( ...@@ -415,6 +415,7 @@ export const NextLogo = forwardRef(function NextLogo(
<button <button
ref={mergeRefs(triggerRef, propRef)} ref={mergeRefs(triggerRef, propRef)}
data-next-mark data-next-mark
data-next-mark-loading={isLoading}
onClick={onTriggerClick} onClick={onTriggerClick}
{...props} {...props}
> >
......
...@@ -9,7 +9,7 @@ type EditorLinkProps = { ...@@ -9,7 +9,7 @@ type EditorLinkProps = {
column: number column: number
} }
} }
export function EditorLink({ file, isSourceFile, location }: EditorLinkProps) { export function EditorLink({ file, location }: EditorLinkProps) {
const open = useOpenInEditor({ const open = useOpenInEditor({
file, file,
lineNumber: location?.line ?? 1, lineNumber: location?.line ?? 1,
...@@ -19,12 +19,7 @@ export function EditorLink({ file, isSourceFile, location }: EditorLinkProps) { ...@@ -19,12 +19,7 @@ export function EditorLink({ file, isSourceFile, location }: EditorLinkProps) {
return ( return (
<div <div
data-with-open-in-editor-link data-with-open-in-editor-link
data-with-open-in-editor-link-source-file={ data-with-open-in-editor-link-import-trace
isSourceFile ? true : undefined
}
data-with-open-in-editor-link-import-trace={
isSourceFile ? undefined : true
}
tabIndex={10} tabIndex={10}
role={'link'} role={'link'}
onClick={open} onClick={open}
...@@ -64,11 +59,4 @@ export const EDITOR_LINK_STYLES = css` ...@@ -64,11 +59,4 @@ export const EDITOR_LINK_STYLES = css`
[data-with-open-in-editor-link-import-trace] { [data-with-open-in-editor-link-import-trace] {
margin-left: var(--size-gap-double); 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({ ...@@ -77,8 +77,8 @@ export const Terminal: React.FC<TerminalProps> = function Terminal({
const open = useOpenInEditor({ const open = useOpenInEditor({
file: file?.fileName, file: file?.fileName,
lineNumber: file?.location?.line, lineNumber: file?.location?.line ?? 1,
column: file?.location?.column, column: file?.location?.column ?? 0,
}) })
const stackFrame = { const stackFrame = {
...@@ -96,6 +96,7 @@ export const Terminal: React.FC<TerminalProps> = function Terminal({ ...@@ -96,6 +96,7 @@ export const Terminal: React.FC<TerminalProps> = function Terminal({
<button <button
aria-label="Open in editor" aria-label="Open in editor"
className="code-frame-header" className="code-frame-header"
data-with-open-in-editor-link-source-file
onClick={open} onClick={open}
> >
<div className="code-frame-link"> <div className="code-frame-link">
......
...@@ -1253,7 +1253,7 @@ export const defaultConfig: NextConfig = { ...@@ -1253,7 +1253,7 @@ export const defaultConfig: NextConfig = {
staticGenerationMinPagesPerWorker: 25, staticGenerationMinPagesPerWorker: 25,
dynamicIO: false, dynamicIO: false,
inlineCss: false, inlineCss: false,
newDevOverlay: false, newDevOverlay: true,
streamingMetadata: false, streamingMetadata: false,
htmlLimitedBots: undefined, htmlLimitedBots: undefined,
useCache: undefined, useCache: undefined,
......
...@@ -923,8 +923,8 @@ function assignDefaults( ...@@ -923,8 +923,8 @@ function assignDefaults(
// TODO(jiwon): remove once we've made new UI default // TODO(jiwon): remove once we've made new UI default
// Enable reactOwnerStack when newDevOverlay is enabled to have // Enable reactOwnerStack when newDevOverlay is enabled to have
// better call stack output in the new UI. // better call stack output in the new UI.
if (process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true') { if (process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'false') {
result.experimental.newDevOverlay = true result.experimental.newDevOverlay = false
} }
if (result.experimental.newDevOverlay) { if (result.experimental.newDevOverlay) {
result.experimental.reactOwnerStack = true result.experimental.reactOwnerStack = true
......
...@@ -50,6 +50,12 @@ const ENDGROUP = process.env.CI ? '##[endgroup]' : '' ...@@ -50,6 +50,12 @@ const ENDGROUP = process.env.CI ? '##[endgroup]' : ''
const externalTestsFilter = getTestFilter() 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 timings = []
const DEFAULT_NUM_RETRIES = 2 const DEFAULT_NUM_RETRIES = 2
const DEFAULT_CONCURRENCY = 2 const DEFAULT_CONCURRENCY = 2
......
...@@ -50,7 +50,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => { ...@@ -50,7 +50,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
await session.assertHasRedbox() await session.assertHasRedbox()
if (process.env.TURBOPACK) { if (process.env.TURBOPACK) {
expect(await session.getRedboxSource()).toMatchInlineSnapshot(` 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' Module not found: Can't resolve 'dns'
> 1 | const dns = require('dns') > 1 | const dns = require('dns')
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
...@@ -60,7 +60,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => { ...@@ -60,7 +60,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
`) `)
} else { } else {
expect(await session.getRedboxSource()).toMatchInlineSnapshot(` 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' Module not found: Can't resolve 'dns'
> 1 | const dns = require('dns') > 1 | const dns = require('dns')
| ^ | ^
...@@ -98,7 +98,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => { ...@@ -98,7 +98,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
const source = await session.getRedboxSource() const source = await session.getRedboxSource()
if (process.env.TURBOPACK) { if (process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"./index.js:1:1 "./index.js (1:1)
Module not found: Can't resolve 'b' Module not found: Can't resolve 'b'
> 1 | import Comp from 'b' > 1 | import Comp from 'b'
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
...@@ -110,7 +110,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => { ...@@ -110,7 +110,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
`) `)
} else { } else {
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"./index.js:1:1 "./index.js (1:1)
Module not found: Can't resolve 'b' Module not found: Can't resolve 'b'
> 1 | import Comp from 'b' > 1 | import Comp from 'b'
| ^ | ^
...@@ -150,7 +150,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => { ...@@ -150,7 +150,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
const source = await session.getRedboxSource() const source = await session.getRedboxSource()
if (process.env.TURBOPACK) { if (process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"./app/page.js:2:1 "./app/page.js (2:1)
Module not found: Can't resolve 'b' Module not found: Can't resolve 'b'
1 | 'use client' 1 | 'use client'
> 2 | import Comp from 'b' > 2 | import Comp from 'b'
...@@ -163,7 +163,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => { ...@@ -163,7 +163,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
`) `)
} else { } else {
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"./app/page.js:2:1 "./app/page.js (2:1)
Module not found: Can't resolve 'b' Module not found: Can't resolve 'b'
1 | 'use client' 1 | 'use client'
> 2 | import Comp from 'b' > 2 | import Comp from 'b'
...@@ -199,7 +199,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => { ...@@ -199,7 +199,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
const source = await session.getRedboxSource() const source = await session.getRedboxSource()
if (process.env.TURBOPACK) { if (process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"./app/page.js:2:1 "./app/page.js (2:1)
Module not found: Can't resolve './non-existent.css' Module not found: Can't resolve './non-existent.css'
1 | 'use client' 1 | 'use client'
> 2 | import './non-existent.css' > 2 | import './non-existent.css'
...@@ -212,7 +212,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => { ...@@ -212,7 +212,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
`) `)
} else { } else {
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"./app/page.js:2:1 "./app/page.js (2:1)
Module not found: Can't resolve './non-existent.css' Module not found: Can't resolve './non-existent.css'
1 | 'use client' 1 | 'use client'
> 2 | import './non-existent.css' > 2 | import './non-existent.css'
......
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
import { createSandbox } from 'development-sandbox' import { createSandbox } from 'development-sandbox'
import { FileRef, nextTestSetup } from 'e2e-utils' import { FileRef, nextTestSetup } from 'e2e-utils'
import { import {
check,
describeVariants as describe, describeVariants as describe,
getStackFramesContent, getStackFramesContent,
retry, retry,
getRedboxCallStack, getRedboxCallStack,
getToastErrorCount,
} from 'next-test-utils' } from 'next-test-utils'
import path from 'path' import path from 'path'
import { outdent } from 'outdent' import { outdent } from 'outdent'
...@@ -220,7 +220,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => { ...@@ -220,7 +220,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
const source = next.normalizeTestDirContent(await session.getRedboxSource()) const source = next.normalizeTestDirContent(await session.getRedboxSource())
if (isTurbopack) { if (isTurbopack) {
expect(source).toEqual(outdent` expect(source).toEqual(outdent`
./index.js:7:1 ./index.js (7:1)
Parsing ecmascript source code failed Parsing ecmascript source code failed
5 | div 5 | div
6 | ) 6 | )
...@@ -351,7 +351,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => { ...@@ -351,7 +351,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
await session.assertHasRedbox() await session.assertHasRedbox()
const source = await session.getRedboxSource() const source = await session.getRedboxSource()
expect(source).toMatch( 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) { if (!isTurbopack) {
expect(source).toMatch('Syntax error: ') expect(source).toMatch('Syntax error: ')
...@@ -436,7 +436,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => { ...@@ -436,7 +436,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
) )
await session.evaluate(() => document.querySelector('button').click()) await session.evaluate(() => document.querySelector('button').click())
await session.openRedbox() await session.assertHasRedbox()
const header2 = await session.getRedboxDescription() const header2 = await session.getRedboxDescription()
expect(header2).toMatchSnapshot() expect(header2).toMatchSnapshot()
...@@ -481,7 +481,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => { ...@@ -481,7 +481,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
) )
await session.evaluate(() => document.querySelector('button').click()) await session.evaluate(() => document.querySelector('button').click())
await session.openRedbox() await session.assertHasRedbox()
const header3 = await session.getRedboxDescription() const header3 = await session.getRedboxDescription()
expect(header3).toMatchSnapshot() expect(header3).toMatchSnapshot()
...@@ -526,7 +526,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => { ...@@ -526,7 +526,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
) )
await session.evaluate(() => document.querySelector('button').click()) await session.evaluate(() => document.querySelector('button').click())
await session.openRedbox() await session.assertHasRedbox()
const header4 = await session.getRedboxDescription() const header4 = await session.getRedboxDescription()
expect(header4).toEqual( expect(header4).toEqual(
...@@ -735,23 +735,15 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => { ...@@ -735,23 +735,15 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
await session.patch('index.js', file) await session.patch('index.js', file)
// Unhandled error and rejection in setTimeout // Unhandled error and rejection in setTimeout
expect( expect(await getToastErrorCount(browser)).toBe(2)
await browser.waitForElementByCss('.nextjs-toast-errors').text()
).toBe('2 issues')
// Unhandled error in event handler // Unhandled error in event handler
await browser.elementById('unhandled-error').click() await browser.elementById('unhandled-error').click()
await check( expect(await getToastErrorCount(browser)).toBe(3)
() => browser.elementByCss('.nextjs-toast-errors').text(),
/3 issues/
)
// Unhandled rejection in event handler // Unhandled rejection in event handler
await browser.elementById('unhandled-rejection').click() await browser.elementById('unhandled-rejection').click()
await check( expect(await getToastErrorCount(browser)).toBe(4)
() => browser.elementByCss('.nextjs-toast-errors').text(),
/4 issues/
)
await session.assertNoRedbox() await session.assertNoRedbox()
// Add Component error // Add Component error
...@@ -1059,7 +1051,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => { ...@@ -1059,7 +1051,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
await session.assertHasRedbox() await session.assertHasRedbox()
if (isTurbopack) { if (isTurbopack) {
expect(await session.getRedboxSource()).toEqual(outdent` expect(await session.getRedboxSource()).toEqual(outdent`
./app/styles2.css:1:2 ./app/styles2.css (1:2)
Module not found: Can't resolve './boom.css' Module not found: Can't resolve './boom.css'
> 1 | @import "./boom.css" > 1 | @import "./boom.css"
| ^ | ^
......
...@@ -280,7 +280,8 @@ describe('ReactRefreshRegression app', () => { ...@@ -280,7 +280,8 @@ describe('ReactRefreshRegression app', () => {
await session.assertHasRedbox() await session.assertHasRedbox()
const source = await session.getRedboxSource() 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'); } "> 1 | export default function () { throw new Error('boom'); }
| ^" | ^"
`) `)
...@@ -298,7 +299,8 @@ describe('ReactRefreshRegression app', () => { ...@@ -298,7 +299,8 @@ describe('ReactRefreshRegression app', () => {
await session.assertHasRedbox() await session.assertHasRedbox()
const source = await session.getRedboxSource() 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'); } "> 1 | export default function Page() { throw new Error('boom'); }
| ^" | ^"
`) `)
...@@ -319,7 +321,8 @@ describe('ReactRefreshRegression app', () => { ...@@ -319,7 +321,8 @@ describe('ReactRefreshRegression app', () => {
await session.assertHasRedbox() await session.assertHasRedbox()
const source = await session.getRedboxSource() 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' " 1 | 'use client'
> 2 | export default function Page() { throw new Error('boom'); } > 2 | export default function Page() { throw new Error('boom'); }
| ^" | ^"
......
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`ReactRefreshLogBox app default Import trace when module not found in layout 1`] = ` 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' Module not found: Can't resolve 'non-existing-module'
> 1 | import "non-existing-module" > 1 | import "non-existing-module"
| ^ | ^
...@@ -43,7 +43,7 @@ exports[`ReactRefreshLogBox app default conversion to class component (1) 1`] = ...@@ -43,7 +43,7 @@ exports[`ReactRefreshLogBox app default conversion to class component (1) 1`] =
`; `;
exports[`ReactRefreshLogBox app default css syntax errors 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) Syntax error: Selector "button" is not pure (pure selectors must contain at least one local class or id)
> 1 | button {} > 1 | button {}
...@@ -110,7 +110,7 @@ exports[`ReactRefreshLogBox app default should strip whitespace correctly with n ...@@ -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`] = ` 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' Module not found: Can't resolve 'non-existing-module'
> 1 | import "non-existing-module" > 1 | import "non-existing-module"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...@@ -119,7 +119,8 @@ https://nextjs.org/docs/messages/module-not-found" ...@@ -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`] = ` 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 () => { 1 | export default () => {
2 | if (typeof window !== 'undefined') { 2 | if (typeof window !== 'undefined') {
......
...@@ -22,7 +22,9 @@ describe('Error overlay - error message urls', () => { ...@@ -22,7 +22,9 @@ describe('Error overlay - error message urls', () => {
await session.assertHasRedbox() 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 text = await link.text()
const href = await link.getAttribute('href') const href = await link.getAttribute('href')
expect(text).toEqual( expect(text).toEqual(
......
...@@ -7,7 +7,9 @@ import { getRedboxTotalErrorCount, retry } from 'next-test-utils' ...@@ -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 // 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', () => { describe('Error overlay for hydration errors in App router', () => {
const { next, isTurbopack } = nextTestSetup({ const { next, isTurbopack } = nextTestSetup({
...@@ -220,6 +222,7 @@ describe('Error overlay for hydration errors in App router', () => { ...@@ -220,6 +222,7 @@ describe('Error overlay for hydration errors in App router', () => {
"... "...
<HotReload assetPrefix="" globalError={[...]}> <HotReload assetPrefix="" globalError={[...]}>
<ReactDevOverlay state={{nextId:1, ...}} dispatcher={{...}} globalError={[...]}> <ReactDevOverlay state={{nextId:1, ...}} dispatcher={{...}} globalError={[...]}>
<DevOverlayErrorBoundary devOverlay={<ShadowPortal>} globalError={[...]} ...>
<DevRootHTTPAccessFallbackBoundary> <DevRootHTTPAccessFallbackBoundary>
<HTTPAccessFallbackBoundary notFound={<NotAllowedRootHTTPFallbackError>}> <HTTPAccessFallbackBoundary notFound={<NotAllowedRootHTTPFallbackError>}>
<HTTPAccessFallbackErrorBoundary pathname="/" notFound={<NotAllowedRootHTTPFallbackError>} ...> <HTTPAccessFallbackErrorBoundary pathname="/" notFound={<NotAllowedRootHTTPFallbackError>} ...>
...@@ -242,6 +245,7 @@ describe('Error overlay for hydration errors in App router', () => { ...@@ -242,6 +245,7 @@ describe('Error overlay for hydration errors in App router', () => {
"... "...
<HotReload assetPrefix="" globalError={[...]}> <HotReload assetPrefix="" globalError={[...]}>
<ReactDevOverlay state={{nextId:1, ...}} dispatcher={{...}} globalError={[...]}> <ReactDevOverlay state={{nextId:1, ...}} dispatcher={{...}} globalError={[...]}>
<DevOverlayErrorBoundary devOverlay={<ShadowPortal>} globalError={[...]} ...>
<DevRootHTTPAccessFallbackBoundary> <DevRootHTTPAccessFallbackBoundary>
<HTTPAccessFallbackBoundary notFound={<NotAllowedRootHTTPFallbackError>}> <HTTPAccessFallbackBoundary notFound={<NotAllowedRootHTTPFallbackError>}>
<HTTPAccessFallbackErrorBoundary pathname="/" notFound={<NotAllowedRootHTTPFallbackError>} ...> <HTTPAccessFallbackErrorBoundary pathname="/" notFound={<NotAllowedRootHTTPFallbackError>} ...>
...@@ -796,7 +800,10 @@ describe('Error overlay for hydration errors in App router', () => { ...@@ -796,7 +800,10 @@ describe('Error overlay for hydration errors in App router', () => {
await session.openRedbox() await session.openRedbox()
await retry(async () => { 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() const description = await session.getRedboxDescription()
......
...@@ -175,7 +175,7 @@ describe('Error overlay - RSC build errors', () => { ...@@ -175,7 +175,7 @@ describe('Error overlay - RSC build errors', () => {
// TODO: fix the issue ordering. // TODO: fix the issue ordering.
// turbopack emits the resolve issue first instead of the transform issue. // turbopack emits the resolve issue first instead of the transform issue.
expect(await session.getRedboxSource()).toMatchInlineSnapshot(` 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 Ecmascript file had an error
> 1 | import 'client-only' > 1 | import 'client-only'
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
...@@ -348,7 +348,7 @@ describe('Error overlay - RSC build errors', () => { ...@@ -348,7 +348,7 @@ describe('Error overlay - RSC build errors', () => {
if (process.env.TURBOPACK) { if (process.env.TURBOPACK) {
expect(next.normalizeTestDirContent(await session.getRedboxSource())) expect(next.normalizeTestDirContent(await session.getRedboxSource()))
.toMatchInlineSnapshot(` .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 Ecmascript file had an error
> 1 | export default function Error() {} > 1 | export default function Error() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
......
...@@ -8,6 +8,9 @@ import { ...@@ -8,6 +8,9 @@ import {
getVersionCheckerText, getVersionCheckerText,
} from 'next-test-utils' } from 'next-test-utils'
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
describe('Error overlay - RSC runtime errors', () => { describe('Error overlay - RSC runtime errors', () => {
const { next } = nextTestSetup({ const { next } = nextTestSetup({
files: new FileRef(path.join(__dirname, 'fixtures', 'rsc-runtime-errors')), files: new FileRef(path.join(__dirname, 'fixtures', 'rsc-runtime-errors')),
...@@ -108,7 +111,11 @@ describe('Error overlay - RSC runtime errors', () => { ...@@ -108,7 +111,11 @@ describe('Error overlay - RSC runtime errors', () => {
await assertHasRedbox(browser) await assertHasRedbox(browser)
const versionText = await getVersionCheckerText(browser) const versionText = await getVersionCheckerText(browser)
if (isNewDevOverlay) {
expect(versionText).toMatch(/Next.js [\w.-]+/)
} else {
expect(versionText).toMatch(/Next.js \([\w.-]+\)/) expect(versionText).toMatch(/Next.js \([\w.-]+\)/)
}
}) })
it('should not show the bundle layer info in the file trace', async () => { it('should not show the bundle layer info in the file trace', async () => {
......
...@@ -11,6 +11,9 @@ function getStaleness(browser: BrowserInterface) { ...@@ -11,6 +11,9 @@ function getStaleness(browser: BrowserInterface) {
.text() .text()
} }
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
describe('Error Overlay version staleness', () => { describe('Error Overlay version staleness', () => {
const { next } = nextTestSetup({ const { next } = nextTestSetup({
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')), files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
...@@ -47,6 +50,20 @@ describe('Error Overlay version staleness', () => { ...@@ -47,6 +50,20 @@ describe('Error Overlay version staleness', () => {
await session.openRedbox() 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) { if (process.env.TURBOPACK) {
expect(await getStaleness(browser)).toMatchInlineSnapshot( expect(await getStaleness(browser)).toMatchInlineSnapshot(
`"Next.js (1.0.0) is outdated (learn more) (Turbopack)"` `"Next.js (1.0.0) is outdated (learn more) (Turbopack)"`
...@@ -56,6 +73,7 @@ describe('Error Overlay version staleness', () => { ...@@ -56,6 +73,7 @@ describe('Error Overlay version staleness', () => {
`"Next.js (1.0.0) is outdated (learn more)"` `"Next.js (1.0.0) is outdated (learn more)"`
) )
} }
}
}) })
it('should show version staleness in render error', async () => { it('should show version staleness in render error', async () => {
...@@ -83,13 +101,16 @@ describe('Error Overlay version staleness', () => { ...@@ -83,13 +101,16 @@ describe('Error Overlay version staleness', () => {
) )
if (process.env.TURBOPACK) { if (process.env.TURBOPACK) {
expect(await getStaleness(browser)).toMatchInlineSnapshot( expect(await getStaleness(browser)).toMatchInlineSnapshot(`
`"Next.js (2.0.0) is outdated (learn more) (Turbopack)"` "Next.js 2.0.0 (outdated)
) (learn more)
Turbopack"
`)
} else { } else {
expect(await getStaleness(browser)).toMatchInlineSnapshot( expect(await getStaleness(browser)).toMatchInlineSnapshot(`
`"Next.js (2.0.0) is outdated (learn more)"` "Next.js 2.0.0 (outdated)
) (learn more)"
`)
} }
}) })
...@@ -115,13 +136,16 @@ describe('Error Overlay version staleness', () => { ...@@ -115,13 +136,16 @@ describe('Error Overlay version staleness', () => {
) )
if (process.env.TURBOPACK) { if (process.env.TURBOPACK) {
expect(await getStaleness(browser)).toMatchInlineSnapshot( expect(await getStaleness(browser)).toMatchInlineSnapshot(`
`"Next.js (3.0.0) is outdated (learn more) (Turbopack)"` "Next.js 3.0.0 (outdated)
) (learn more)
Turbopack"
`)
} else { } else {
expect(await getStaleness(browser)).toMatchInlineSnapshot( expect(await getStaleness(browser)).toMatchInlineSnapshot(`
`"Next.js (3.0.0) is outdated (learn more)"` "Next.js 3.0.0 (outdated)
) (learn more)"
`)
} }
}) })
}) })
...@@ -97,7 +97,7 @@ describe.each(['default', 'turbo'])( ...@@ -97,7 +97,7 @@ describe.each(['default', 'turbo'])(
const source = next.normalizeTestDirContent(content) const source = next.normalizeTestDirContent(content)
if (process.env.TURBOPACK) { if (process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"./pages/_app.js:2:11 "./pages/_app.js (2:11)
Parsing ecmascript source code failed Parsing ecmascript source code failed
1 | function MyApp({ Component, pageProps }) { 1 | function MyApp({ Component, pageProps }) {
> 2 | return <<Component {...pageProps} />; > 2 | return <<Component {...pageProps} />;
...@@ -184,7 +184,7 @@ describe.each(['default', 'turbo'])( ...@@ -184,7 +184,7 @@ describe.each(['default', 'turbo'])(
) )
if (process.env.TURBOPACK) { if (process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"./pages/_document.js:3:36 "./pages/_document.js (3:36)
Parsing ecmascript source code failed Parsing ecmascript source code failed
1 | import Document, { Html, Head, Main, NextScript } from 'next/document' 1 | import Document, { Html, Head, Main, NextScript } from 'next/document'
2 | 2 |
......
...@@ -47,7 +47,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => { ...@@ -47,7 +47,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
await session.assertHasRedbox() await session.assertHasRedbox()
if (process.env.TURBOPACK) { if (process.env.TURBOPACK) {
expect(await session.getRedboxSource()).toMatchInlineSnapshot(` 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' Module not found: Can't resolve 'dns'
> 1 | const dns = require('dns') > 1 | const dns = require('dns')
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
...@@ -57,7 +57,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => { ...@@ -57,7 +57,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
`) `)
} else { } else {
expect(await session.getRedboxSource()).toMatchInlineSnapshot(` 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' Module not found: Can't resolve 'dns'
> 1 | const dns = require('dns') > 1 | const dns = require('dns')
| ^ | ^
...@@ -96,7 +96,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => { ...@@ -96,7 +96,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
const source = await session.getRedboxSource() const source = await session.getRedboxSource()
if (process.env.TURBOPACK) { if (process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"./index.js:1:1 "./index.js (1:1)
Module not found: Can't resolve 'b' Module not found: Can't resolve 'b'
> 1 | import Comp from 'b' > 1 | import Comp from 'b'
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
...@@ -108,7 +108,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => { ...@@ -108,7 +108,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
`) `)
} else { } else {
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"./index.js:1:1 "./index.js (1:1)
Module not found: Can't resolve 'b' Module not found: Can't resolve 'b'
> 1 | import Comp from 'b' > 1 | import Comp from 'b'
| ^ | ^
...@@ -148,7 +148,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => { ...@@ -148,7 +148,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
const source = await session.getRedboxSource() const source = await session.getRedboxSource()
if (process.env.TURBOPACK) { if (process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"./pages/index.js:1:1 "./pages/index.js (1:1)
Module not found: Can't resolve 'b' Module not found: Can't resolve 'b'
> 1 | import Comp from 'b' > 1 | import Comp from 'b'
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
...@@ -160,7 +160,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => { ...@@ -160,7 +160,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
`) `)
} else { } else {
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"./pages/index.js:1:1 "./pages/index.js (1:1)
Module not found: Can't resolve 'b' Module not found: Can't resolve 'b'
> 1 | import Comp from 'b' > 1 | import Comp from 'b'
| ^ | ^
...@@ -203,7 +203,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => { ...@@ -203,7 +203,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
const source = await session.getRedboxSource() const source = await session.getRedboxSource()
if (process.env.TURBOPACK) { if (process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"./pages/_app.js:1:1 "./pages/_app.js (1:1)
Module not found: Can't resolve './non-existent.css' Module not found: Can't resolve './non-existent.css'
> 1 | import './non-existent.css' > 1 | import './non-existent.css'
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
...@@ -215,7 +215,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => { ...@@ -215,7 +215,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
`) `)
} else { } else {
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"./pages/_app.js:1:1 "./pages/_app.js (1:1)
Module not found: Can't resolve './non-existent.css' Module not found: Can't resolve './non-existent.css'
> 1 | import './non-existent.css' > 1 | import './non-existent.css'
| ^ | ^
......
...@@ -213,7 +213,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => { ...@@ -213,7 +213,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
const source = next.normalizeTestDirContent(await session.getRedboxSource()) const source = next.normalizeTestDirContent(await session.getRedboxSource())
if (process.env.TURBOPACK) { if (process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"./index.js:7:1 "./index.js (7:1)
Parsing ecmascript source code failed Parsing ecmascript source code failed
5 | div 5 | div
6 | ) 6 | )
...@@ -345,8 +345,8 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => { ...@@ -345,8 +345,8 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
const source = await session.getRedboxSource() const source = await session.getRedboxSource()
expect(source).toMatch( expect(source).toMatch(
process.env.TURBOPACK process.env.TURBOPACK
? './index.module.css:1:9' ? './index.module.css (1:9)'
: './index.module.css:1:1' : './index.module.css (1:1)'
) )
if (!process.env.TURBOPACK) { if (!process.env.TURBOPACK) {
expect(source).toMatch('Syntax error: ') expect(source).toMatch('Syntax error: ')
......
...@@ -284,7 +284,8 @@ describe('ReactRefreshRegression', () => { ...@@ -284,7 +284,8 @@ describe('ReactRefreshRegression', () => {
await session.assertHasRedbox() await session.assertHasRedbox()
const source = await session.getRedboxSource() 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'); } "> 1 | export default function () { throw new Error('boom'); }
| ^" | ^"
`) `)
......
...@@ -19,7 +19,7 @@ exports[`ReactRefreshLogBox default conversion to class component (1) 1`] = ` ...@@ -19,7 +19,7 @@ exports[`ReactRefreshLogBox default conversion to class component (1) 1`] = `
`; `;
exports[`ReactRefreshLogBox default css syntax errors 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) Syntax error: Selector "button" is not pure (pure selectors must contain at least one local class or id)
> 1 | button {} > 1 | button {}
......
...@@ -437,7 +437,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => { ...@@ -437,7 +437,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
if (isTurbopack) { if (isTurbopack) {
// TODO: Remove this branching once import traces are implemented in Turbopack // TODO: Remove this branching once import traces are implemented in Turbopack
expect(redboxSource).toMatchInlineSnapshot(` expect(redboxSource).toMatchInlineSnapshot(`
"./index.js:7:41 "./index.js (7:41)
Parsing ecmascript source code failed Parsing ecmascript source code failed
5 | throw Error('no ' + i) 5 | throw Error('no ' + i)
6 | }, 1000) 6 | }, 1000)
...@@ -474,7 +474,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => { ...@@ -474,7 +474,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
if (isTurbopack) { if (isTurbopack) {
// TODO: Remove this branching once import traces are implemented in Turbopack // TODO: Remove this branching once import traces are implemented in Turbopack
expect(redboxSource).toMatchInlineSnapshot(` expect(redboxSource).toMatchInlineSnapshot(`
"./index.js:7:41 "./index.js (7:41)
Parsing ecmascript source code failed Parsing ecmascript source code failed
5 | throw Error('no ' + i) 5 | throw Error('no ' + i)
6 | }, 1000) 6 | }, 1000)
......
...@@ -52,7 +52,7 @@ describe('Error Overlay for server components compiler errors in pages', () => { ...@@ -52,7 +52,7 @@ describe('Error Overlay for server components compiler errors in pages', () => {
if (process.env.TURBOPACK) { if (process.env.TURBOPACK) {
expect(next.normalizeTestDirContent(await session.getRedboxSource())) expect(next.normalizeTestDirContent(await session.getRedboxSource()))
.toMatchInlineSnapshot(` .toMatchInlineSnapshot(`
"./components/Comp.js:1:1 "./components/Comp.js (1:1)
Ecmascript file had an error Ecmascript file had an error
> 1 | import { cookies } from 'next/headers' > 1 | import { cookies } from 'next/headers'
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...@@ -108,7 +108,7 @@ describe('Error Overlay for server components compiler errors in pages', () => { ...@@ -108,7 +108,7 @@ describe('Error Overlay for server components compiler errors in pages', () => {
if (process.env.TURBOPACK) { if (process.env.TURBOPACK) {
expect(next.normalizeTestDirContent(await session.getRedboxSource())) expect(next.normalizeTestDirContent(await session.getRedboxSource()))
.toMatchInlineSnapshot(` .toMatchInlineSnapshot(`
"./components/Comp.js:1:1 "./components/Comp.js (1:1)
Ecmascript file had an error Ecmascript file had an error
> 1 | import 'server-only' > 1 | import 'server-only'
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
...@@ -166,7 +166,7 @@ describe('Error Overlay for server components compiler errors in pages', () => { ...@@ -166,7 +166,7 @@ describe('Error Overlay for server components compiler errors in pages', () => {
if (process.env.TURBOPACK) { if (process.env.TURBOPACK) {
expect(next.normalizeTestDirContent(await session.getRedboxSource())) expect(next.normalizeTestDirContent(await session.getRedboxSource()))
.toMatchInlineSnapshot(` .toMatchInlineSnapshot(`
"./components/Comp.js:1:10 "./components/Comp.js (1:10)
Ecmascript file had an error Ecmascript file had an error
> 1 | import { after } from 'next/server' > 1 | import { after } from 'next/server'
| ^^^^^ | ^^^^^
......
...@@ -34,8 +34,8 @@ describe('app-dir - capture-console-error', () => { ...@@ -34,8 +34,8 @@ describe('app-dir - capture-console-error', () => {
files: __dirname, files: __dirname,
}) })
if (process.env.__NEXT_EXPERIMENTAL_PPR === 'true') { if (process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true') {
it('skip test for experimental PPR', () => { it('skip test for new overlay', () => {
// Cover these tests in the owner stack tests suite // Cover these tests in the owner stack tests suite
}) })
return return
......
...@@ -11,9 +11,8 @@ describe('error-ignored-frames', () => { ...@@ -11,9 +11,8 @@ describe('error-ignored-frames', () => {
}) })
if ( if (
// TODO: remove this when reactOwnerStack is enabled by default // TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
// Since PPR mode is just going to add owner stack, skip this test for now process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true' ||
process.env.__NEXT_EXPERIMENTAL_PPR === 'true' ||
// Skip react 18 test as the call stacks are different // Skip react 18 test as the call stacks are different
process.env.NEXT_TEST_REACT_VERSION === '18.3.1' process.env.NEXT_TEST_REACT_VERSION === '18.3.1'
) { ) {
......
...@@ -9,9 +9,12 @@ import { ...@@ -9,9 +9,12 @@ import {
} from 'next-test-utils' } from 'next-test-utils'
import { outdent } from 'outdent' 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 // 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({ const { next } = nextTestSetup({
files: __dirname, files: __dirname,
}) })
...@@ -44,4 +47,5 @@ describe('app-dir - missing required html tags', () => { ...@@ -44,4 +47,5 @@ describe('app-dir - missing required html tags', () => {
await assertNoRedbox(browser) await assertNoRedbox(browser)
expect(await browser.elementByCss('p').text()).toBe('hello world') expect(await browser.elementByCss('p').text()).toBe('hello world')
}) })
}) }
)
...@@ -7,8 +7,10 @@ import { ...@@ -7,8 +7,10 @@ import {
getStackFramesContent, getStackFramesContent,
} from 'next-test-utils' } 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.__NEXT_EXPERIMENTAL_PPR === 'true' const isOwnerStackEnabled =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true' ||
process.env.__NEXT_EXPERIMENTAL_PPR === 'true'
;(isOwnerStackEnabled ? describe.skip : describe)( ;(isOwnerStackEnabled ? describe.skip : describe)(
'app-dir - invalid-element-type', 'app-dir - invalid-element-type',
......
...@@ -5,10 +5,10 @@ import { ...@@ -5,10 +5,10 @@ import {
getStackFramesContent, getStackFramesContent,
} from 'next-test-utils' } 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 = const isOwnerStackEnabled =
process.env.TEST_OWNER_STACK !== 'false' || process.env.TEST_OWNER_STACK !== 'false' ||
process.env.__NEXT_EXPERIMENTAL_PPR === 'true' process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
;(isOwnerStackEnabled ? describe : describe.skip)( ;(isOwnerStackEnabled ? describe : describe.skip)(
'app-dir - owner-stack-invalid-element-type', 'app-dir - owner-stack-invalid-element-type',
......
...@@ -5,10 +5,12 @@ import { ...@@ -5,10 +5,12 @@ import {
getStackFramesContent, getStackFramesContent,
} from 'next-test-utils' } 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.__NEXT_EXPERIMENTAL_PPR === 'true' 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', 'app-dir - owner-stack-react-missing-key-prop',
() => { () => {
const { next } = nextTestSetup({ const { next } = nextTestSetup({
...@@ -24,7 +26,7 @@ const isOwnerStackEnabled = process.env.__NEXT_EXPERIMENTAL_PPR === 'true' ...@@ -24,7 +26,7 @@ const isOwnerStackEnabled = process.env.__NEXT_EXPERIMENTAL_PPR === 'true'
if (process.env.TURBOPACK) { if (process.env.TURBOPACK) {
expect(stackFramesContent).toMatchInlineSnapshot(` expect(stackFramesContent).toMatchInlineSnapshot(`
"at span (<anonymous> (0:0)) "at span ()
at <anonymous> (app/rsc/page.tsx (7:10)) at <anonymous> (app/rsc/page.tsx (7:10))
at Page (app/rsc/page.tsx (6:13))" at Page (app/rsc/page.tsx (6:13))"
`) `)
...@@ -67,9 +69,9 @@ const isOwnerStackEnabled = process.env.__NEXT_EXPERIMENTAL_PPR === 'true' ...@@ -67,9 +69,9 @@ const isOwnerStackEnabled = process.env.__NEXT_EXPERIMENTAL_PPR === 'true'
const source = await getRedboxSource(browser) const source = await getRedboxSource(browser)
if (process.env.TURBOPACK) { if (process.env.TURBOPACK) {
expect(stackFramesContent).toMatchInlineSnapshot(` expect(stackFramesContent).toMatchInlineSnapshot(`
"at p (<anonymous> (0:0)) "at p ()
at <unknown> (app/ssr/page.tsx (9:9)) 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))" at Page (app/ssr/page.tsx (8:13))"
`) `)
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
......
...@@ -5,8 +5,10 @@ import { ...@@ -5,8 +5,10 @@ import {
hasRedboxCallStack, hasRedboxCallStack,
} from 'next-test-utils' } 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.__NEXT_EXPERIMENTAL_PPR === 'true' const isExperimentalReact =
process.env.__NEXT_EXPERIMENTAL_PPR === 'true' ||
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
async function getStackFramesContent(browser) { async function getStackFramesContent(browser) {
await hasRedboxCallStack(browser) await hasRedboxCallStack(browser)
...@@ -37,7 +39,7 @@ async function getStackFramesContent(browser) { ...@@ -37,7 +39,7 @@ async function getStackFramesContent(browser) {
} }
// Without owner stack, the source is not available // Without owner stack, the source is not available
;(isOwnerStackEnabled ? describe.skip : describe)( ;(isExperimentalReact ? describe.skip : describe)(
'app-dir - react-missing-key-prop', 'app-dir - react-missing-key-prop',
() => { () => {
const { next } = nextTestSetup({ const { next } = nextTestSetup({
......
...@@ -71,7 +71,7 @@ describe('app-dir - owner-stack', () => { ...@@ -71,7 +71,7 @@ describe('app-dir - owner-stack', () => {
return log.message.includes('Error: browser error') return log.message.includes('Error: browser error')
}).message }).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 (isNewDevOverlay) {
if (process.env.TURBOPACK) { if (process.env.TURBOPACK) {
expect(normalizeStackTrace(errorLog)).toMatchInlineSnapshot(` expect(normalizeStackTrace(errorLog)).toMatchInlineSnapshot(`
...@@ -130,7 +130,7 @@ describe('app-dir - owner-stack', () => { ...@@ -130,7 +130,7 @@ describe('app-dir - owner-stack', () => {
at renderRootSync at renderRootSync
at performWorkOnRoot at performWorkOnRoot
at performWorkOnRootViaSchedulerTask 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 { } else {
expect(normalizeStackTrace(errorLog)).toMatchInlineSnapshot(` expect(normalizeStackTrace(errorLog)).toMatchInlineSnapshot(`
......
...@@ -5,7 +5,7 @@ import { ...@@ -5,7 +5,7 @@ import {
getRedboxSource, getRedboxSource,
} from 'next-test-utils' } 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 = const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true' process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
...@@ -24,12 +24,11 @@ describe('app-dir - server-component-next-dynamic-ssr-false', () => { ...@@ -24,12 +24,11 @@ describe('app-dir - server-component-next-dynamic-ssr-false', () => {
expect(redbox.description).toBe('Failed to compile') 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 (isNewDevOverlay) {
if (process.env.TURBOPACK) { if (process.env.TURBOPACK) {
expect(redbox.source).toMatchInlineSnapshot(` expect(redbox.source).toMatchInlineSnapshot(`
"./app/page.js (3:23) "./app/page.js (3:23)
Ecmascript file had an error Ecmascript file had an error
1 | import dynamic from 'next/dynamic' 1 | import dynamic from 'next/dynamic'
2 | 2 |
...@@ -59,7 +58,7 @@ describe('app-dir - server-component-next-dynamic-ssr-false', () => { ...@@ -59,7 +58,7 @@ describe('app-dir - server-component-next-dynamic-ssr-false', () => {
} else { } else {
if (process.env.TURBOPACK) { if (process.env.TURBOPACK) {
expect(redbox.source).toMatchInlineSnapshot(` expect(redbox.source).toMatchInlineSnapshot(`
"./app/page.js:3:23 "./app/page.js (3:23)
Ecmascript file had an error Ecmascript file had an error
1 | import dynamic from 'next/dynamic' 1 | import dynamic from 'next/dynamic'
2 | 2 |
......
...@@ -7,8 +7,11 @@ import { ...@@ -7,8 +7,11 @@ import {
getRedboxSource, getRedboxSource,
} from 'next-test-utils' } from 'next-test-utils'
const isReactExperimental = process.env.__NEXT_EXPERIMENTAL_PPR === 'true' const isNewDevOverlay =
const isNewDevOverlay = isReactExperimental 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 const isReact18 = parseInt(process.env.NEXT_TEST_REACT_VERSION) === 18
describe('react-dom/server in React Server environment', () => { describe('react-dom/server in React Server environment', () => {
...@@ -284,7 +287,7 @@ describe('react-dom/server in React Server environment', () => { ...@@ -284,7 +287,7 @@ describe('react-dom/server in React Server environment', () => {
expect(redbox).toMatchInlineSnapshot(` expect(redbox).toMatchInlineSnapshot(`
{ {
"description": "Failed to compile", "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 Ecmascript file had an error
1 | import * as ReactDOMServerEdge from 'react-dom/server' 1 | import * as ReactDOMServerEdge from 'react-dom/server'
2 | // Fine to drop once React is on ESM 2 | // Fine to drop once React is on ESM
...@@ -379,7 +382,7 @@ describe('react-dom/server in React Server environment', () => { ...@@ -379,7 +382,7 @@ describe('react-dom/server in React Server environment', () => {
expect(redbox).toMatchInlineSnapshot(` expect(redbox).toMatchInlineSnapshot(`
{ {
"description": "Failed to compile", "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 Ecmascript file had an error
1 | import * as ReactDOMServerNode from 'react-dom/server' 1 | import * as ReactDOMServerNode from 'react-dom/server'
2 | // Fine to drop once React is on ESM 2 | // Fine to drop once React is on ESM
...@@ -394,7 +397,7 @@ describe('react-dom/server in React Server environment', () => { ...@@ -394,7 +397,7 @@ describe('react-dom/server in React Server environment', () => {
} }
`) `)
} else { } 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) { if (isNewDevOverlay) {
expect(redbox).toMatchInlineSnapshot(` expect(redbox).toMatchInlineSnapshot(`
{ {
......
...@@ -11,7 +11,23 @@ import { ...@@ -11,7 +11,23 @@ import {
} from 'next-test-utils' } from 'next-test-utils'
import { NextInstance } from 'e2e-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) => { 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() { return browser.eval(`(function() {
window.checkInterval = setInterval(function() { window.checkInterval = setInterval(function() {
let watcherDiv = document.querySelector('#__next-build-indicator') let watcherDiv = document.querySelector('#__next-build-indicator')
...@@ -22,6 +38,7 @@ const installCheckVisible = (browser) => { ...@@ -22,6 +38,7 @@ const installCheckVisible = (browser) => {
if (window.showedBuilder) clearInterval(window.checkInterval) if (window.showedBuilder) clearInterval(window.checkInterval)
}, 50) }, 50)
})()`) })()`)
}
} }
describe('GS(S)P Server-Side Change Reloading', () => { describe('GS(S)P Server-Side Change Reloading', () => {
......
...@@ -195,7 +195,7 @@ describe.each([ ...@@ -195,7 +195,7 @@ describe.each([
`) `)
} else if (basePath === '' && process.env.TURBOPACK) { } else if (basePath === '' && process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"./pages/hmr/about2.js:7:1 "./pages/hmr/about2.js (7:1)
Parsing ecmascript source code failed Parsing ecmascript source code failed
5 | div 5 | div
6 | ) 6 | )
...@@ -231,7 +231,7 @@ describe.each([ ...@@ -231,7 +231,7 @@ describe.each([
`) `)
} else if (basePath === '/docs' && process.env.TURBOPACK) { } else if (basePath === '/docs' && process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"./pages/hmr/about2.js:7:1 "./pages/hmr/about2.js (7:1)
Parsing ecmascript source code failed Parsing ecmascript source code failed
5 | div 5 | div
6 | ) 6 | )
...@@ -594,7 +594,7 @@ describe.each([ ...@@ -594,7 +594,7 @@ describe.each([
if (process.env.TURBOPACK) { if (process.env.TURBOPACK) {
expect(next.normalizeTestDirContent(redboxSource)) expect(next.normalizeTestDirContent(redboxSource))
.toMatchInlineSnapshot(` .toMatchInlineSnapshot(`
"./components/parse-error.js:3:1 "./components/parse-error.js (3:1)
Parsing ecmascript source code failed Parsing ecmascript source code failed
1 | This 1 | This
2 | is 2 | is
......
...@@ -29,12 +29,16 @@ describe('client-dev-overlay', () => { ...@@ -29,12 +29,16 @@ describe('client-dev-overlay', () => {
const selectors = { const selectors = {
fullScreenDialog: '[data-nextjs-dialog]', fullScreenDialog: '[data-nextjs-dialog]',
toast: '[data-nextjs-toast]', toast: '[data-nextjs-toast]',
minimizeButton: '[data-nextjs-errors-dialog-left-right-close-button]', popover: '[data-nextjs-dev-tools-button]',
hideButton: '[data-nextjs-toast-errors-hide-button]', minimizeButton: 'body',
hideButton: '[data-hide-dev-tools]',
} }
function getToast() { function getToast() {
return browser.elementByCss(selectors.toast) return browser.elementByCss(selectors.toast)
} }
function getPopover() {
return browser.elementByCss(selectors.popover)
}
function getMinimizeButton() { function getMinimizeButton() {
return browser.elementByCss(selectors.minimizeButton) return browser.elementByCss(selectors.minimizeButton)
} }
...@@ -64,10 +68,11 @@ describe('client-dev-overlay', () => { ...@@ -64,10 +68,11 @@ describe('client-dev-overlay', () => {
it('should be able to hide the minimized overlay', async () => { it('should be able to hide the minimized overlay', async () => {
await getMinimizeButton().click() await getMinimizeButton().click()
await getPopover().click()
await getHideButton().click() await getHideButton().click()
await check(async () => { await check(async () => {
const exists = await elementExistsInNextJSPortalShadowDOM('div') const exists = await elementExistsInNextJSPortalShadowDOM(selectors.toast)
return exists ? 'found' : 'success' return exists ? 'found' : 'success'
}, 'success') }, 'success')
}) })
......
...@@ -41,7 +41,7 @@ export default withRouter( ...@@ -41,7 +41,7 @@ export default withRouter(
render() { render() {
return ( return (
<div className="shallow-routing"> <div className="shallow-routing" style={{ paddingBottom: 60 }}>
<Link href="/nav" id="home-link" style={linkStyle}> <Link href="/nav" id="home-link" style={linkStyle}>
Home Home
</Link> </Link>
......
...@@ -26,7 +26,7 @@ describe('app dir - css', () => { ...@@ -26,7 +26,7 @@ describe('app dir - css', () => {
// css-loader does not report an error for this case // css-loader does not report an error for this case
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"./app/global.scss.css:45:1 "./app/global.scss.css (45:1)
Parsing css source code failed Parsing css source code failed
43 | } 43 | }
44 | 44 |
......
...@@ -25,8 +25,12 @@ describe('dynamic-io', () => { ...@@ -25,8 +25,12 @@ describe('dynamic-io', () => {
expect(await browser.elementByCss('p').text()).toBe('result') expect(await browser.elementByCss('p').text()).toBe('result')
}) })
if (process.env.__NEXT_EXPERIMENTAL_PPR && isNextDev) { if (
// TODO(react-time-info): Remove this branch for PPR in dev mode when the (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 // 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 // payload makes the serialized bound args not suitable to be used as a
// cache key. // cache key.
......
...@@ -19,14 +19,15 @@ describe('dynamic-io', () => { ...@@ -19,14 +19,15 @@ describe('dynamic-io', () => {
if (isNextDev && !WITH_PPR) { if (isNextDev && !WITH_PPR) {
async function hasStaticIndicator(browser: BrowserInterface) { async function hasStaticIndicator(browser: BrowserInterface) {
const staticIndicatorPresent = await browser.eval(() => await browser.elementByCss('[data-nextjs-dev-tools-button]').click()
Boolean(
return await browser.eval(
() =>
document document
.querySelector('nextjs-portal') .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 () => { it('should not have static indicator on dynamic method route', async () => {
......
...@@ -26,12 +26,11 @@ describe('app-dir - error-on-next-codemod-comment', () => { ...@@ -26,12 +26,11 @@ describe('app-dir - error-on-next-codemod-comment', () => {
await assertHasRedbox(browser) 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 (isNewDevOverlay) {
if (process.env.TURBOPACK) { if (process.env.TURBOPACK) {
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(` expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
"./app/page.tsx (2:2) "./app/page.tsx (2:2)
Ecmascript file had an error Ecmascript file had an error
1 | export default function Page() { 1 | export default function Page() {
> 2 | // @next-codemod-error remove jsx of next line > 2 | // @next-codemod-error remove jsx of next line
...@@ -62,7 +61,7 @@ describe('app-dir - error-on-next-codemod-comment', () => { ...@@ -62,7 +61,7 @@ describe('app-dir - error-on-next-codemod-comment', () => {
} else { } else {
if (process.env.TURBOPACK) { if (process.env.TURBOPACK) {
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(` expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
"./app/page.tsx:2:2 "./app/page.tsx (2:2)
Ecmascript file had an error Ecmascript file had an error
1 | export default function Page() { 1 | export default function Page() {
> 2 | // @next-codemod-error remove jsx of next line > 2 | // @next-codemod-error remove jsx of next line
......
/* eslint-env jest */
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
import { retry } from 'next-test-utils' import { retry } from 'next-test-utils'
import { createProxyServer } from 'next/experimental/testmode/proxy' import { createProxyServer } from 'next/experimental/testmode/proxy'
...@@ -8,8 +7,12 @@ import * as Log from './utils/log' ...@@ -8,8 +7,12 @@ import * as Log from './utils/log'
const runtimes = ['nodejs', 'edge'] 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) => { describe.each(runtimes)('after() in %s runtime', (runtimeValue) => {
const { next, isNextDeploy, skipped } = nextTestSetup({ const { next, isNextDeploy, skipped, isTurbopack } = nextTestSetup({
files: __dirname, files: __dirname,
// `patchFile` and reading runtime logs are not supported in a deployed environment // `patchFile` and reading runtime logs are not supported in a deployed environment
skipDeployment: true, skipDeployment: true,
...@@ -98,7 +101,12 @@ describe.each(runtimes)('after() in %s runtime', (runtimeValue) => { ...@@ -98,7 +101,12 @@ describe.each(runtimes)('after() in %s runtime', (runtimeValue) => {
}) })
describe('interrupted RSC renders', () => { 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 next.browser(pathPrefix + '/interrupted/calls-redirect')
await retry(() => { await retry(() => {
...@@ -109,7 +117,8 @@ describe.each(runtimes)('after() in %s runtime', (runtimeValue) => { ...@@ -109,7 +117,8 @@ describe.each(runtimes)('after() in %s runtime', (runtimeValue) => {
source: '[page] /interrupted/redirect-target', source: '[page] /interrupted/redirect-target',
}) })
}) })
}) }
)
it('runs callbacks if notFound() was called', async () => { it('runs callbacks if notFound() was called', async () => {
await next.browser(pathPrefix + '/interrupted/calls-not-found') await next.browser(pathPrefix + '/interrupted/calls-not-found')
......
...@@ -425,8 +425,10 @@ describe('app dir - rsc basics', () => { ...@@ -425,8 +425,10 @@ describe('app dir - rsc basics', () => {
}) })
// TODO: (PPR) remove once PPR is stable // TODO: (PPR) remove once PPR is stable
// TODO(new-dev-overlay): remove once new dev overlay is stable
const bundledReactVersionPattern = const bundledReactVersionPattern =
process.env.__NEXT_EXPERIMENTAL_PPR === 'true' process.env.__NEXT_EXPERIMENTAL_PPR === 'true' ||
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
? '-experimental-' ? '-experimental-'
: '-canary-' : '-canary-'
......
...@@ -10,6 +10,13 @@ import { ...@@ -10,6 +10,13 @@ import {
} from 'next-test-utils' } from 'next-test-utils'
import stripAnsi from 'strip-ansi' 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 = 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".' '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', () => { ...@@ -192,8 +199,8 @@ describe('use-cache-hanging-inputs', () => {
const cliOutput = stripAnsi(next.cliOutput.slice(outputIndex)) const cliOutput = stripAnsi(next.cliOutput.slice(outputIndex))
if (process.env.__NEXT_EXPERIMENTAL_PPR) { if (needsExperimentalReact) {
// TODO(react-time-info): Remove this branch for PPR when the issue is // 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 // resolved where the inclusion of server timings in the RSC payload
// makes the serialized bound args not suitable to be used as a cache // makes the serialized bound args not suitable to be used as a cache
// key. // key.
......
...@@ -31,7 +31,7 @@ describe('use-cache-segment-configs', () => { ...@@ -31,7 +31,7 @@ describe('use-cache-segment-configs', () => {
expect(description).toBe('Failed to compile') expect(description).toBe('Failed to compile')
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"./app/runtime/page.tsx:1:14 "./app/runtime/page.tsx (1:14)
Ecmascript file had an error Ecmascript file had an error
> 1 | export const runtime = 'edge' > 1 | export const runtime = 'edge'
| ^^^^^^^ | ^^^^^^^
......
...@@ -90,12 +90,11 @@ describe('use-cache-unknown-cache-kind', () => { ...@@ -90,12 +90,11 @@ describe('use-cache-unknown-cache-kind', () => {
expect(errorDescription).toBe('Failed to compile') 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 (isNewDevOverlay) {
if (isTurbopack) { if (isTurbopack) {
expect(errorSource).toMatchInlineSnapshot(` expect(errorSource).toMatchInlineSnapshot(`
"./app/page.tsx (1:1) "./app/page.tsx (1:1)
Ecmascript file had an error Ecmascript file had an error
> 1 | 'use cache: custom' > 1 | 'use cache: custom'
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
...@@ -122,7 +121,7 @@ describe('use-cache-unknown-cache-kind', () => { ...@@ -122,7 +121,7 @@ describe('use-cache-unknown-cache-kind', () => {
} else { } else {
if (isTurbopack) { if (isTurbopack) {
expect(errorSource).toMatchInlineSnapshot(` expect(errorSource).toMatchInlineSnapshot(`
"./app/page.tsx:1:1 "./app/page.tsx (1:1)
Ecmascript file had an error Ecmascript file had an error
> 1 | 'use cache: custom' > 1 | 'use cache: custom'
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
......
...@@ -89,12 +89,11 @@ describe('use-cache-without-experimental-flag', () => { ...@@ -89,12 +89,11 @@ describe('use-cache-without-experimental-flag', () => {
expect(errorDescription).toBe('Failed to compile') 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 (isNewDevOverlay) {
if (isTurbopack) { if (isTurbopack) {
expect(errorSource).toMatchInlineSnapshot(` expect(errorSource).toMatchInlineSnapshot(`
"./app/page.tsx (1:1) "./app/page.tsx (1:1)
Ecmascript file had an error Ecmascript file had an error
> 1 | 'use cache' > 1 | 'use cache'
| ^^^^^^^^^^^ | ^^^^^^^^^^^
...@@ -125,7 +124,7 @@ describe('use-cache-without-experimental-flag', () => { ...@@ -125,7 +124,7 @@ describe('use-cache-without-experimental-flag', () => {
} else { } else {
if (isTurbopack) { if (isTurbopack) {
expect(errorSource).toMatchInlineSnapshot(` expect(errorSource).toMatchInlineSnapshot(`
"./app/page.tsx:1:1 "./app/page.tsx (1:1)
Ecmascript file had an error Ecmascript file had an error
> 1 | 'use cache' > 1 | 'use cache'
| ^^^^^^^^^^^ | ^^^^^^^^^^^
......
...@@ -11,7 +11,23 @@ const nextConfig = join(appDir, 'next.config.js') ...@@ -11,7 +11,23 @@ const nextConfig = join(appDir, 'next.config.js')
let appPort let appPort
let app 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) => { 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() { return browser.eval(`(function() {
window.checkInterval = setInterval(function() { window.checkInterval = setInterval(function() {
let watcherDiv = document.querySelector('#__next-build-indicator') let watcherDiv = document.querySelector('#__next-build-indicator')
...@@ -22,6 +38,7 @@ const installCheckVisible = (browser) => { ...@@ -22,6 +38,7 @@ const installCheckVisible = (browser) => {
if (window.showedBuilder) clearInterval(window.checkInterval) if (window.showedBuilder) clearInterval(window.checkInterval)
}, 5) }, 5)
})()`) })()`)
}
} }
describe('Build Activity Indicator', () => { describe('Build Activity Indicator', () => {
...@@ -67,6 +84,9 @@ describe('Build Activity Indicator', () => { ...@@ -67,6 +84,9 @@ describe('Build Activity Indicator', () => {
}) })
afterAll(() => killApp(app)) 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 () => { it('Adds the build indicator container', async () => {
const browser = await webdriver( const browser = await webdriver(
appPort, appPort,
...@@ -76,6 +96,8 @@ describe('Build Activity Indicator', () => { ...@@ -76,6 +96,8 @@ describe('Build Activity Indicator', () => {
expect(html).toMatch(/__next-build-indicator/) expect(html).toMatch(/__next-build-indicator/)
await browser.close() await browser.close()
}) })
}
;(process.env.TURBOPACK ? describe.skip : describe)('webpack only', () => { ;(process.env.TURBOPACK ? describe.skip : describe)('webpack only', () => {
it('Shows the build indicator when a page is built during navigation', async () => { it('Shows the build indicator when a page is built during navigation', async () => {
const browser = await webdriver( const browser = await webdriver(
......
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
const isReact18 = parseInt(process.env.NEXT_TEST_REACT_VERSION) === 18 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', () => { describe('custom server', () => {
const { next } = nextTestSetup({ const { next } = nextTestSetup({
...@@ -23,10 +26,12 @@ describe('custom server', () => { ...@@ -23,10 +26,12 @@ describe('custom server', () => {
}) })
describe('with app dir', () => { describe('with app dir', () => {
if (!isNewDevOverlay) {
it('should render app with react canary', async () => { it('should render app with react canary', async () => {
const $ = await next.render$(`/1`) const $ = await next.render$(`/1`)
expect($('body').text()).toMatch(/app: .+-canary/) expect($('body').text()).toMatch(/app: .+-canary/)
}) })
}
it('should render pages with installed react', async () => { it('should render pages with installed react', async () => {
const $ = await next.render$(`/2`) 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