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,27 +50,27 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => { ...@@ -50,27 +50,27 @@ 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')
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
2 | module.exports = dns 2 | module.exports = dns
https://nextjs.org/docs/messages/module-not-found" https://nextjs.org/docs/messages/module-not-found"
`) `)
} 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')
| ^ | ^
2 | module.exports = dns 2 | module.exports = dns
https://nextjs.org/docs/messages/module-not-found https://nextjs.org/docs/messages/module-not-found
Import trace for requested module: Import trace for requested module:
./index.js ./index.js
./app/page.js" ./app/page.js"
`) `)
} }
}) })
...@@ -98,30 +98,30 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => { ...@@ -98,30 +98,30 @@ 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'
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
2 | export default function Oops() { 2 | export default function Oops() {
3 | return ( 3 | return (
4 | <div> 4 | <div>
https://nextjs.org/docs/messages/module-not-found" https://nextjs.org/docs/messages/module-not-found"
`) `)
} 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'
| ^ | ^
2 | export default function Oops() { 2 | export default function Oops() {
3 | return ( 3 | return (
4 | <div> 4 | <div>
https://nextjs.org/docs/messages/module-not-found https://nextjs.org/docs/messages/module-not-found
Import trace for requested module: Import trace for requested module:
./app/page.js" ./app/page.js"
`) `)
} }
}) })
...@@ -150,29 +150,29 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => { ...@@ -150,29 +150,29 @@ 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'
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
3 | export default function Oops() { 3 | export default function Oops() {
4 | return ( 4 | return (
5 | <div> 5 | <div>
https://nextjs.org/docs/messages/module-not-found" https://nextjs.org/docs/messages/module-not-found"
`) `)
} 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'
| ^ | ^
3 | export default function Oops() { 3 | export default function Oops() {
4 | return ( 4 | return (
5 | <div> 5 | <div>
https://nextjs.org/docs/messages/module-not-found" https://nextjs.org/docs/messages/module-not-found"
`) `)
} }
}) })
...@@ -199,29 +199,29 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => { ...@@ -199,29 +199,29 @@ 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'
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
3 | export default function Page(props) { 3 | export default function Page(props) {
4 | return <p>index page</p> 4 | return <p>index page</p>
5 | } 5 | }
https://nextjs.org/docs/messages/module-not-found" https://nextjs.org/docs/messages/module-not-found"
`) `)
} 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'
| ^ | ^
3 | export default function Page(props) { 3 | export default function Page(props) {
4 | return <p>index page</p> 4 | return <p>index page</p>
5 | } 5 | }
https://nextjs.org/docs/messages/module-not-found" https://nextjs.org/docs/messages/module-not-found"
`) `)
} }
await session.patch( await session.patch(
......
...@@ -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,41 +222,43 @@ describe('Error overlay for hydration errors in App router', () => { ...@@ -220,41 +222,43 @@ 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={[...]}>
<DevRootHTTPAccessFallbackBoundary> <DevOverlayErrorBoundary devOverlay={<ShadowPortal>} globalError={[...]} ...>
<HTTPAccessFallbackBoundary notFound={<NotAllowedRootHTTPFallbackError>}> <DevRootHTTPAccessFallbackBoundary>
<HTTPAccessFallbackErrorBoundary pathname="/" notFound={<NotAllowedRootHTTPFallbackError>} ...> <HTTPAccessFallbackBoundary notFound={<NotAllowedRootHTTPFallbackError>}>
<RedirectBoundary> <HTTPAccessFallbackErrorBoundary pathname="/" notFound={<NotAllowedRootHTTPFallbackError>} ...>
<RedirectErrorBoundary router={{...}}> <RedirectBoundary>
<Head> <RedirectErrorBoundary router={{...}}>
<script> <Head>
<script> <script>
<script> <script>
<ClientSegmentRoot Component={function Root} slots={{...}} params={{}}> <script>
<Root params={Promise}> <ClientSegmentRoot Component={function Root} slots={{...}} params={{}}>
<html <Root params={Promise}>
- className="server-html" <html
> - className="server-html"
... >
..." ...
..."
`) `)
} else { } else {
expect(pseudoHtml).toMatchInlineSnapshot(` expect(pseudoHtml).toMatchInlineSnapshot(`
"... "...
<HotReload assetPrefix="" globalError={[...]}> <HotReload assetPrefix="" globalError={[...]}>
<ReactDevOverlay state={{nextId:1, ...}} dispatcher={{...}} globalError={[...]}> <ReactDevOverlay state={{nextId:1, ...}} dispatcher={{...}} globalError={[...]}>
<DevRootHTTPAccessFallbackBoundary> <DevOverlayErrorBoundary devOverlay={<ShadowPortal>} globalError={[...]} ...>
<HTTPAccessFallbackBoundary notFound={<NotAllowedRootHTTPFallbackError>}> <DevRootHTTPAccessFallbackBoundary>
<HTTPAccessFallbackErrorBoundary pathname="/" notFound={<NotAllowedRootHTTPFallbackError>} ...> <HTTPAccessFallbackBoundary notFound={<NotAllowedRootHTTPFallbackError>}>
<RedirectBoundary> <HTTPAccessFallbackErrorBoundary pathname="/" notFound={<NotAllowedRootHTTPFallbackError>} ...>
<RedirectErrorBoundary router={{...}}> <RedirectBoundary>
<Head> <RedirectErrorBoundary router={{...}}>
<ClientSegmentRoot Component={function Root} slots={{...}} params={{}}> <Head>
<Root params={Promise}> <ClientSegmentRoot Component={function Root} slots={{...}} params={{}}>
<html <Root params={Promise}>
- className="server-html" <html
> - className="server-html"
... >
..." ...
..."
`) `)
} }
...@@ -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,13 +348,13 @@ describe('Error overlay - RSC build errors', () => { ...@@ -348,13 +348,13 @@ 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() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/server-with-errors/error-file/error.js must be a Client Component. Add the "use client" directive the top of the file to resolve this issue. app/server-with-errors/error-file/error.js must be a Client Component. Add the "use client" directive the top of the file to resolve this issue.
Learn more: https://nextjs.org/docs/app/api-reference/directives/use-client" Learn more: https://nextjs.org/docs/app/api-reference/directives/use-client"
`) `)
} else { } else {
await expect(session.getRedboxSource()).resolves.toMatch( await expect(session.getRedboxSource()).resolves.toMatch(
......
...@@ -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)
expect(versionText).toMatch(/Next.js \([\w.-]+\)/) 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 () => { 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,14 +50,29 @@ describe('Error Overlay version staleness', () => { ...@@ -47,14 +50,29 @@ describe('Error Overlay version staleness', () => {
await session.openRedbox() await session.openRedbox()
if (process.env.TURBOPACK) { if (isNewDevOverlay) {
expect(await getStaleness(browser)).toMatchInlineSnapshot( if (process.env.TURBOPACK) {
`"Next.js (1.0.0) is outdated (learn more) (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 { } else {
expect(await getStaleness(browser)).toMatchInlineSnapshot( if (process.env.TURBOPACK) {
`"Next.js (1.0.0) is outdated (learn more)"` expect(await getStaleness(browser)).toMatchInlineSnapshot(
) `"Next.js (1.0.0) is outdated (learn more) (Turbopack)"`
)
} else {
expect(await getStaleness(browser)).toMatchInlineSnapshot(
`"Next.js (1.0.0) is outdated (learn more)"`
)
}
} }
}) })
...@@ -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,15 +97,15 @@ describe.each(['default', 'turbo'])( ...@@ -97,15 +97,15 @@ 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} />;
| ^ | ^
3 | } 3 | }
4 | export default MyApp 4 | export default MyApp
Expression expected" Expression expected"
`) `)
} else { } else {
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
...@@ -184,17 +184,17 @@ describe.each(['default', 'turbo'])( ...@@ -184,17 +184,17 @@ 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 |
> 3 | class MyDocument extends Document {{ > 3 | class MyDocument extends Document {{
| ^ | ^
4 | static async getInitialProps(ctx) { 4 | static async getInitialProps(ctx) {
5 | const initialProps = await Document.getInitialProps(ctx) 5 | const initialProps = await Document.getInitialProps(ctx)
6 | return { ...initialProps } 6 | return { ...initialProps }
Unexpected token \`{\`. Expected identifier, string literal, numeric literal or [ for the computed key" Unexpected token \`{\`. Expected identifier, string literal, numeric literal or [ for the computed key"
`) `)
} else { } else {
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
......
...@@ -47,27 +47,27 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => { ...@@ -47,27 +47,27 @@ 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')
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
2 | module.exports = dns 2 | module.exports = dns
https://nextjs.org/docs/messages/module-not-found" https://nextjs.org/docs/messages/module-not-found"
`) `)
} 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')
| ^ | ^
2 | module.exports = dns 2 | module.exports = dns
https://nextjs.org/docs/messages/module-not-found https://nextjs.org/docs/messages/module-not-found
Import trace for requested module: Import trace for requested module:
./index.js ./index.js
./pages/index.js" ./pages/index.js"
`) `)
} }
}) })
...@@ -96,30 +96,30 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => { ...@@ -96,30 +96,30 @@ 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'
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
2 | 2 |
3 | export default function Oops() { 3 | export default function Oops() {
4 | return ( 4 | return (
https://nextjs.org/docs/messages/module-not-found" https://nextjs.org/docs/messages/module-not-found"
`) `)
} 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'
| ^ | ^
2 | 2 |
3 | export default function Oops() { 3 | export default function Oops() {
4 | return ( 4 | return (
https://nextjs.org/docs/messages/module-not-found https://nextjs.org/docs/messages/module-not-found
Import trace for requested module: Import trace for requested module:
./pages/index.js" ./pages/index.js"
`) `)
} }
}) })
...@@ -148,27 +148,27 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => { ...@@ -148,27 +148,27 @@ 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'
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
2 | 2 |
3 | export default function Oops() { 3 | export default function Oops() {
4 | return ( 4 | return (
https://nextjs.org/docs/messages/module-not-found" https://nextjs.org/docs/messages/module-not-found"
`) `)
} 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'
| ^ | ^
2 | 2 |
3 | export default function Oops() { 3 | export default function Oops() {
4 | return ( 4 | return (
https://nextjs.org/docs/messages/module-not-found" https://nextjs.org/docs/messages/module-not-found"
`) `)
} }
}) })
...@@ -203,27 +203,27 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => { ...@@ -203,27 +203,27 @@ 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'
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 | 2 |
3 | export default function App({ Component, pageProps }) { 3 | export default function App({ Component, pageProps }) {
4 | return <Component {...pageProps} /> 4 | return <Component {...pageProps} />
https://nextjs.org/docs/messages/module-not-found" https://nextjs.org/docs/messages/module-not-found"
`) `)
} 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'
| ^ | ^
2 | 2 |
3 | export default function App({ Component, pageProps }) { 3 | export default function App({ Component, pageProps }) {
4 | return <Component {...pageProps} /> 4 | return <Component {...pageProps} />
https://nextjs.org/docs/messages/module-not-found" https://nextjs.org/docs/messages/module-not-found"
`) `)
} }
......
...@@ -213,14 +213,14 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => { ...@@ -213,14 +213,14 @@ 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 | )
> 7 | } > 7 | }
| ^ | ^
Unexpected token. Did you mean \`{'}'}\` or \`&rbrace;\`?" Unexpected token. Did you mean \`{'}'}\` or \`&rbrace;\`?"
`) `)
} else { } else {
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
...@@ -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,9 +284,10 @@ describe('ReactRefreshRegression', () => { ...@@ -284,9 +284,10 @@ 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+/, ''))
"> 1 | export default function () { throw new Error('boom'); } .toMatchInlineSnapshot(`
| ^" "> 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,14 +437,14 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => { ...@@ -437,14 +437,14 @@ 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)
> 7 | export default function FunctionNamed() { > 7 | export default function FunctionNamed() {
| ^ | ^
Expected '}', got '<eof>'" Expected '}', got '<eof>'"
`) `)
} else { } else {
expect(redboxSource).toMatchInlineSnapshot(` expect(redboxSource).toMatchInlineSnapshot(`
...@@ -474,14 +474,14 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => { ...@@ -474,14 +474,14 @@ 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)
> 7 | export default function FunctionNamed() { > 7 | export default function FunctionNamed() {
| ^ | ^
Expected '}', got '<eof>'" Expected '}', got '<eof>'"
`) `)
} else { } else {
expect(redboxSource).toMatchInlineSnapshot(` expect(redboxSource).toMatchInlineSnapshot(`
......
...@@ -52,15 +52,15 @@ describe('Error Overlay for server components compiler errors in pages', () => { ...@@ -52,15 +52,15 @@ 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'
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 | 2 |
3 | export default function Page() { 3 | export default function Page() {
4 | return <p>hello world</p> 4 | return <p>hello world</p>
You're importing a component that needs "next/headers". That only works in a Server Component which is not supported in the pages/ directory. Read more: https://nextjs.org/docs/app/building-your-application/rendering/server-components" You're importing a component that needs "next/headers". That only works in a Server Component which is not supported in the pages/ directory. Read more: https://nextjs.org/docs/app/building-your-application/rendering/server-components"
`) `)
} else { } else {
expect(next.normalizeTestDirContent(await session.getRedboxSource())) expect(next.normalizeTestDirContent(await session.getRedboxSource()))
...@@ -108,15 +108,15 @@ describe('Error Overlay for server components compiler errors in pages', () => { ...@@ -108,15 +108,15 @@ 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'
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
2 | 2 |
3 | export default function Page() { 3 | export default function Page() {
4 | return 'hello world' 4 | return 'hello world'
You're importing a component that needs "server-only". That only works in a Server Component which is not supported in the pages/ directory. Read more: https://nextjs.org/docs/app/building-your-application/rendering/server-components" You're importing a component that needs "server-only". That only works in a Server Component which is not supported in the pages/ directory. Read more: https://nextjs.org/docs/app/building-your-application/rendering/server-components"
`) `)
} else { } else {
expect( expect(
...@@ -166,15 +166,15 @@ describe('Error Overlay for server components compiler errors in pages', () => { ...@@ -166,15 +166,15 @@ 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'
| ^^^^^ | ^^^^^
2 | 2 |
3 | export default function Page() { 3 | export default function Page() {
4 | return 'hello world' 4 | return 'hello world'
You're importing a component that needs "after". That only works in a Server Component which is not supported in the pages/ directory. Read more: https://nextjs.org/docs/app/building-your-application/rendering/server-components" You're importing a component that needs "after". That only works in a Server Component which is not supported in the pages/ directory. Read more: https://nextjs.org/docs/app/building-your-application/rendering/server-components"
`) `)
} else { } else {
expect( expect(
......
...@@ -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,39 +9,43 @@ import { ...@@ -9,39 +9,43 @@ 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'
const { next } = nextTestSetup({ ;(isDisabled ? describe.skip : describe)(
files: __dirname, 'app-dir - missing required html tags',
}) () => {
const { next } = nextTestSetup({
files: __dirname,
})
it('should display correct error count in dev indicator', async () => { it('should display correct error count in dev indicator', async () => {
const browser = await next.browser('/') const browser = await next.browser('/')
retry(async () => { retry(async () => {
expect(await hasErrorToast(browser)).toBe(true) expect(await hasErrorToast(browser)).toBe(true)
}) })
// Dev indicator should show 1 error // Dev indicator should show 1 error
expect(await getToastErrorCount(browser)).toBe(1) expect(await getToastErrorCount(browser)).toBe(1)
await assertHasRedbox(browser) await assertHasRedbox(browser)
await retry(async () => { await retry(async () => {
expect(await getRedboxDescription(browser)).toEqual(outdent` expect(await getRedboxDescription(browser)).toEqual(outdent`
The following tags are missing in the Root Layout: <html>. The following tags are missing in the Root Layout: <html>.
Read more at https://nextjs.org/docs/messages/missing-root-layout-tags Read more at https://nextjs.org/docs/messages/missing-root-layout-tags
`) `)
}) })
await next.patchFile('app/layout.js', (code) => await next.patchFile('app/layout.js', (code) =>
code.replace( code.replace(
'return <body>{children}</body>', 'return <body>{children}</body>',
'return <html><body>{children}</body></html>' 'return <html><body>{children}</body></html>'
)
) )
)
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,13 +26,13 @@ const isOwnerStackEnabled = process.env.__NEXT_EXPERIMENTAL_PPR === 'true' ...@@ -24,13 +26,13 @@ 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))"
`) `)
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"app/rsc/page.tsx (7:10) @ <anonymous> "app/rsc/page.tsx (7:10) @ <anonymous>
5 | <div> 5 | <div>
6 | {list.map((item, index) => ( 6 | {list.map((item, index) => (
> 7 | <span>{item}</span> > 7 | <span>{item}</span>
...@@ -38,7 +40,7 @@ const isOwnerStackEnabled = process.env.__NEXT_EXPERIMENTAL_PPR === 'true' ...@@ -38,7 +40,7 @@ const isOwnerStackEnabled = process.env.__NEXT_EXPERIMENTAL_PPR === 'true'
8 | ))} 8 | ))}
9 | </div> 9 | </div>
10 | )" 10 | )"
`) `)
} else { } else {
expect(stackFramesContent).toMatchInlineSnapshot(` expect(stackFramesContent).toMatchInlineSnapshot(`
"at span () "at span ()
...@@ -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(`
...@@ -115,22 +115,22 @@ describe('app-dir - owner-stack', () => { ...@@ -115,22 +115,22 @@ describe('app-dir - owner-stack', () => {
} else { } else {
if (process.env.TURBOPACK) { if (process.env.TURBOPACK) {
expect(normalizeStackTrace(errorLog)).toMatchInlineSnapshot(` expect(normalizeStackTrace(errorLog)).toMatchInlineSnapshot(`
"%o "%o
%s Error: browser error %s Error: browser error
at useThrowError at useThrowError
at useErrorHook at useErrorHook
at Page at Page
at react-stack-bottom-frame at react-stack-bottom-frame
at renderWithHooks at renderWithHooks
at updateFunctionComponent at updateFunctionComponent
at beginWork at beginWork
at runWithFiberInDEV at runWithFiberInDEV
at performUnitOfWork at performUnitOfWork
at workLoopSync at workLoopSync
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(`
...@@ -260,7 +260,7 @@ describe('app-dir - owner-stack', () => { ...@@ -260,7 +260,7 @@ describe('app-dir - owner-stack', () => {
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 <ReactDevOverlay> error boundary."
`) `)
} }
}) })
......
...@@ -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,23 +24,22 @@ describe('app-dir - server-component-next-dynamic-ssr-false', () => { ...@@ -24,23 +24,22 @@ 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
1 | import dynamic from 'next/dynamic'
2 |
> 3 | const DynamicClient = dynamic(() => import('./client'), { ssr: false })
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 |
5 | export default function Page() {
6 | return <DynamicClient />
Ecmascript file had an error \`ssr: false\` is not allowed with \`next/dynamic\` in Server Components. Please move it into a client component."
1 | import dynamic from 'next/dynamic' `)
2 |
> 3 | const DynamicClient = dynamic(() => import('./client'), { ssr: false })
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 |
5 | export default function Page() {
6 | return <DynamicClient />
\`ssr: false\` is not allowed with \`next/dynamic\` in Server Components. Please move it into a client component."
`)
} else { } else {
expect(redbox.source).toMatchInlineSnapshot(` expect(redbox.source).toMatchInlineSnapshot(`
"./app/page.js "./app/page.js
...@@ -59,18 +58,18 @@ describe('app-dir - server-component-next-dynamic-ssr-false', () => { ...@@ -59,18 +58,18 @@ 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 |
> 3 | const DynamicClient = dynamic(() => import('./client'), { ssr: false }) > 3 | const DynamicClient = dynamic(() => import('./client'), { ssr: false })
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 | 4 |
5 | export default function Page() { 5 | export default function Page() {
6 | return <DynamicClient /> 6 | return <DynamicClient />
\`ssr: false\` is not allowed with \`next/dynamic\` in Server Components. Please move it into a client component." \`ssr: false\` is not allowed with \`next/dynamic\` in Server Components. Please move it into a client component."
`) `)
} else { } else {
expect(redbox.source).toMatchInlineSnapshot(` expect(redbox.source).toMatchInlineSnapshot(`
"./app/page.js "./app/page.js
......
...@@ -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', () => {
...@@ -282,21 +285,21 @@ describe('react-dom/server in React Server environment', () => { ...@@ -282,21 +285,21 @@ describe('react-dom/server in React Server environment', () => {
} }
if (isTurbopack) { if (isTurbopack) {
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
> 3 | import ReactDOMServerEdgeDefault from 'react-dom/server' > 3 | import ReactDOMServerEdgeDefault from 'react-dom/server'
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 | 4 |
5 | export const runtime = 'edge' 5 | export const runtime = 'edge'
6 | 6 |
You're importing a component that imports react-dom/server. To fix it, render or return the content directly as a Server Component instead for perf and security. You're importing a component that imports react-dom/server. To fix it, render or return the content directly as a Server Component instead for perf and security.
Learn more: https://nextjs.org/docs/app/building-your-application/rendering", Learn more: https://nextjs.org/docs/app/building-your-application/rendering",
} }
`) `)
} else { } else {
expect(redbox).toMatchInlineSnapshot(` expect(redbox).toMatchInlineSnapshot(`
...@@ -377,24 +380,24 @@ describe('react-dom/server in React Server environment', () => { ...@@ -377,24 +380,24 @@ describe('react-dom/server in React Server environment', () => {
} }
if (isTurbopack) { if (isTurbopack) {
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
> 3 | import ReactDOMServerNodeDefault from 'react-dom/server' > 3 | import ReactDOMServerNodeDefault from 'react-dom/server'
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 | 4 |
5 | export const runtime = 'nodejs' 5 | export const runtime = 'nodejs'
6 | 6 |
You're importing a component that imports react-dom/server. To fix it, render or return the content directly as a Server Component instead for perf and security. You're importing a component that imports react-dom/server. To fix it, render or return the content directly as a Server Component instead for perf and security.
Learn more: https://nextjs.org/docs/app/building-your-application/rendering", Learn more: https://nextjs.org/docs/app/building-your-application/rendering",
} }
`) `)
} 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(`
{ {
...@@ -831,16 +834,16 @@ describe('react-dom/server in React Server environment', () => { ...@@ -831,16 +834,16 @@ describe('react-dom/server in React Server environment', () => {
`) `)
} else { } else {
expect(redbox).toMatchInlineSnapshot(` expect(redbox).toMatchInlineSnapshot(`
{ {
"description": "Error: react-dom/server is not supported in React Server Components.", "description": "Error: react-dom/server is not supported in React Server Components.",
"source": "internal-pkg/server.node.js (1:1) @ [project]/internal-pkg/server.node.js [app-rsc] (ecmascript) "source": "internal-pkg/server.node.js (1:1) @ [project]/internal-pkg/server.node.js [app-rsc] (ecmascript)
> 1 | import * as ReactDOMServerEdge from 'react-dom/server.node' > 1 | import * as ReactDOMServerEdge from 'react-dom/server.node'
| ^ | ^
2 | // Fine to drop once React is on ESM 2 | // Fine to drop once React is on ESM
3 | import ReactDOMServerEdgeDefault from 'react-dom/server.node' 3 | import ReactDOMServerEdgeDefault from 'react-dom/server.node'
4 |", 4 |",
} }
`) `)
} }
} else { } else {
......
...@@ -11,9 +11,25 @@ import { ...@@ -11,9 +11,25 @@ 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) => {
return browser.eval(`(function() { if (isNewDevOverlay) {
window.checkInterval = setInterval(function() { 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') let watcherDiv = document.querySelector('#__next-build-indicator')
watcherDiv = watcherDiv.shadowRoot || watcherDiv watcherDiv = watcherDiv.shadowRoot || watcherDiv
window.showedBuilder = window.showedBuilder || ( window.showedBuilder = window.showedBuilder || (
...@@ -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,16 +195,16 @@ describe.each([ ...@@ -195,16 +195,16 @@ 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 | )
> 7 | } > 7 | }
| ^ | ^
8 | 8 |
Unexpected token. Did you mean \`{'}'}\` or \`&rbrace;\`?" Unexpected token. Did you mean \`{'}'}\` or \`&rbrace;\`?"
`) `)
} else if (basePath === '/docs' && !process.env.TURBOPACK) { } else if (basePath === '/docs' && !process.env.TURBOPACK) {
expect(source).toMatchInlineSnapshot(` expect(source).toMatchInlineSnapshot(`
"./pages/hmr/about2.js "./pages/hmr/about2.js
...@@ -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,17 +594,17 @@ describe.each([ ...@@ -594,17 +594,17 @@ 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
> 3 | }}} > 3 | }}}
| ^ | ^
4 | invalid 4 | invalid
5 | js 5 | js
Expression expected" Expression expected"
`) `)
} else { } else {
redboxSource = redboxSource.substring( redboxSource = redboxSource.substring(
0, 0,
......
...@@ -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,17 +26,17 @@ describe('app dir - css', () => { ...@@ -26,17 +26,17 @@ 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 |
> 45 | input.defaultCheckbox::before path { > 45 | input.defaultCheckbox::before path {
| ^ | ^
46 | fill: currentColor; 46 | fill: currentColor;
47 | } 47 | }
48 | 48 |
Pseudo-elements like '::before' or '::after' can't be followed by selectors like 'Ident("path")' at [project]/app/global.scss.css:0:884" Pseudo-elements like '::before' or '::after' can't be followed by selectors like 'Ident("path")' at [project]/app/global.scss.css:0:884"
`) `)
}) })
} }
......
...@@ -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,23 +26,22 @@ describe('app-dir - error-on-next-codemod-comment', () => { ...@@ -26,23 +26,22 @@ 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 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 | return <p>hello world</p>
3 | return <p>hello world</p> 4 | }
4 | } 5 |
5 |
You have an unresolved @next/codemod comment "remove jsx of next line" that needs review.
You have an unresolved @next/codemod comment "remove jsx of next line" that needs review. After review, either remove the comment if you made the necessary changes or replace "@next-codemod-error" with "@next-codemod-ignore" to bypass the build error if no action at this line can be taken."
After review, either remove the comment if you made the necessary changes or replace "@next-codemod-error" with "@next-codemod-ignore" to bypass the build error if no action at this line can be taken." `)
`)
} else { } else {
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(` expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
"./app/page.tsx "./app/page.tsx
...@@ -62,18 +61,18 @@ describe('app-dir - error-on-next-codemod-comment', () => { ...@@ -62,18 +61,18 @@ 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
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3 | return <p>hello world</p> 3 | return <p>hello world</p>
4 | } 4 | }
5 | 5 |
You have an unresolved @next/codemod comment "remove jsx of next line" that needs review. You have an unresolved @next/codemod comment "remove jsx of next line" that needs review.
After review, either remove the comment if you made the necessary changes or replace "@next-codemod-error" with "@next-codemod-ignore" to bypass the build error if no action at this line can be taken." After review, either remove the comment if you made the necessary changes or replace "@next-codemod-error" with "@next-codemod-ignore" to bypass the build error if no action at this line can be taken."
`) `)
} else { } else {
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(` expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
"./app/page.tsx "./app/page.tsx
......
/* 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,18 +101,24 @@ describe.each(runtimes)('after() in %s runtime', (runtimeValue) => { ...@@ -98,18 +101,24 @@ 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
await next.browser(pathPrefix + '/interrupted/calls-redirect') // https://github.com/vercel/next.js/pull/75989
await retry(() => { ;(isTurbopack && isReactExperimental ? it.skip : it)(
expect(getLogs()).toContainEqual({ 'runs callbacks if redirect() was called',
source: '[page] /interrupted/calls-redirect', async () => {
}) await next.browser(pathPrefix + '/interrupted/calls-redirect')
expect(getLogs()).toContainEqual({
source: '[page] /interrupted/redirect-target', await retry(() => {
expect(getLogs()).toContainEqual({
source: '[page] /interrupted/calls-redirect',
})
expect(getLogs()).toContainEqual({
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,15 +121,15 @@ describe('use-cache-unknown-cache-kind', () => { ...@@ -122,15 +121,15 @@ 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'
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
2 | 2 |
3 | export default async function Page() { 3 | export default async function Page() {
4 | return <p>hello world</p> 4 | return <p>hello world</p>
Unknown cache kind "custom". Please configure a cache handler for this kind in the "experimental.cacheHandlers" object in your Next.js config." Unknown cache kind "custom". Please configure a cache handler for this kind in the "experimental.cacheHandlers" object in your Next.js config."
`) `)
} else { } else {
expect(errorSource).toMatchInlineSnapshot(` expect(errorSource).toMatchInlineSnapshot(`
......
...@@ -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,9 +11,25 @@ const nextConfig = join(appDir, 'next.config.js') ...@@ -11,9 +11,25 @@ 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) => {
return browser.eval(`(function() { if (isNewDevOverlay) {
window.checkInterval = setInterval(function() { 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') let watcherDiv = document.querySelector('#__next-build-indicator')
watcherDiv = watcherDiv.shadowRoot || watcherDiv watcherDiv = watcherDiv.shadowRoot || watcherDiv
window.showedBuilder = window.showedBuilder || ( window.showedBuilder = window.showedBuilder || (
...@@ -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,15 +84,20 @@ describe('Build Activity Indicator', () => { ...@@ -67,15 +84,20 @@ describe('Build Activity Indicator', () => {
}) })
afterAll(() => killApp(app)) afterAll(() => killApp(app))
it('Adds the build indicator container', async () => { // The indicator has no special container in the new dev overlay -
const browser = await webdriver( // it's rendered as part of the indicator logo
appPort, if (!isNewDevOverlay) {
pagesOrApp === 'pages' ? '/' : '/app' it('Adds the build indicator container', async () => {
) const browser = await webdriver(
const html = await browser.eval('document.body.innerHTML') appPort,
expect(html).toMatch(/__next-build-indicator/) pagesOrApp === 'pages' ? '/' : '/app'
await browser.close() )
}) const html = await browser.eval('document.body.innerHTML')
expect(html).toMatch(/__next-build-indicator/)
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', () => {
it('should render app with react canary', async () => { if (!isNewDevOverlay) {
const $ = await next.render$(`/1`) it('should render app with react canary', async () => {
expect($('body').text()).toMatch(/app: .+-canary/) const $ = await next.render$(`/1`)
}) 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