Unverified Commit a89d55c0 authored by Jiwon Choi's avatar Jiwon Choi Committed by GitHub

[dev-overlay] Remove old Dev Overlay (#76256)

This PR removed the old overlay including the deprecated `buildActivity`
and `appIsrStatus` options.

Closes NDX-785
Closes NDX-855
Closes NDX-865
Closes NDX-866
Closes NDX-867
Closes NDX-868
parent c8ac0bdd
......@@ -581,7 +581,7 @@ jobs:
uses: ./.github/workflows/build_reusable.yml
with:
nodeVersion: 18.18.2
afterBuild: __NEXT_EXPERIMENTAL_PPR=true __NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY=false 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_EXTERNAL_TESTS_FILTERS="test/ppr-tests-manifest.json" node run-tests.js --timings -c ${TEST_CONCURRENCY} --type integration
stepName: 'test-ppr-integration'
secrets: inherit
......@@ -596,7 +596,7 @@ jobs:
group: [1/6, 2/6, 3/6, 4/6, 5/6, 6/6]
uses: ./.github/workflows/build_reusable.yml
with:
afterBuild: __NEXT_EXPERIMENTAL_PPR=true __NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY=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
afterBuild: __NEXT_EXPERIMENTAL_PPR=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
stepName: 'test-ppr-dev-${{ matrix.group }}'
secrets: inherit
......@@ -611,7 +611,7 @@ jobs:
group: [1/7, 2/7, 3/7, 4/7, 5/7, 6/7, 7/7]
uses: ./.github/workflows/build_reusable.yml
with:
afterBuild: __NEXT_EXPERIMENTAL_PPR=true __NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY=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
afterBuild: __NEXT_EXPERIMENTAL_PPR=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
stepName: 'test-ppr-prod-${{ matrix.group }}'
secrets: inherit
......
......@@ -37,7 +37,6 @@
"unoptimized": false
},
"devIndicators": {
"buildActivity": true,
"buildActivityPosition": "bottom-right"
},
"onDemandEntries": {
......
......@@ -213,7 +213,6 @@ pub enum BuildActivityPositions {
)]
#[serde(rename_all = "camelCase")]
pub struct DevIndicatorsOptions {
pub build_activity: Option<bool>,
pub build_activity_position: Option<BuildActivityPositions>,
pub position: Option<BuildActivityPositions>,
}
......
......@@ -11,8 +11,6 @@ description: Optimized pages include an indicator to let you know if it's being
```ts filename="Types"
devIndicators: {
appIsrStatus?: boolean, // defaults to true
buildActivity?: boolean, // defaults to true
buildActivityPosition?: 'bottom-right'
| 'bottom-left'
| 'top-right'
......@@ -20,69 +18,6 @@ description: Optimized pages include an indicator to let you know if it's being
},
```
## `appIsrStatus` (Static Indicator)
Next.js displays a static indicator in the bottom corner of the screen that signals if a route will be prerendered at build time. This makes it easier to understand whether a route is static or dynamic, and for you to identify if a route [opts out of static rendering](#static-route-not-showing-the-indicator).
<Image
alt="App Folder Structure"
srcLight="/docs/light/static-indicator.png"
srcDark="/docs/dark/static-indicator.png"
width="1600"
height="208"
/>
You can temporarily hide the indicator by clicking the close indicator which will remember your preference in `localStorage` for 1 hour. To permanently disable it, you can use the config option in `next.config.js`:
```ts filename="next.config.ts" switcher
import type { NextConfig } from 'next'
const nextConfig: NextConfig = {
devIndicators: {
appIsrStatus: false,
},
}
export default nextConfig
```
```js filename="next.config.js" switcher
/** @type {import('next').NextConfig} */
const nextConfig = {
devIndicators: {
appIsrStatus: false,
},
}
module.exports = nextConfig
```
## `buildActivity` (Compilation Indicator)
When you edit your code, and Next.js is compiling the application, a compilation indicator appears in the bottom right corner of the page.
> **Good to know**: This indicator is only present in development mode and will not appear when building and running the app in production mode.
In some cases this indicator can be misplaced on your page, for example, when conflicting with a chat launcher. To change its position, open `next.config.js` and set the `buildActivityPosition` in the `devIndicators` object to `bottom-right` (default), `bottom-left`, `top-right` or `top-left`:
```js filename="next.config.js"
module.exports = {
devIndicators: {
buildActivityPosition: 'bottom-right',
},
}
```
In some cases, this indicator might not be useful for you. To remove it, open `next.config.js` and disable the `buildActivity` config in `devIndicators` object:
```js filename="next.config.js"
module.exports = {
devIndicators: {
buildActivity: false,
},
}
```
## Troubleshooting
### Static route not showing the indicator
......
......@@ -2179,10 +2179,6 @@ export default async function getBaseWebpackConfig(
crossOrigin: config.crossOrigin,
pageExtensions: pageExtensions,
trailingSlash: config.trailingSlash,
buildActivity:
config.devIndicators === false
? false
: config.devIndicators.buildActivity,
buildActivityPosition:
config.devIndicators === false
? undefined
......
......@@ -185,9 +185,6 @@ export function getDefineEnv({
'process.env.__NEXT_APP_NAV_FAIL_HANDLING': Boolean(
config.experimental.appNavFailHandling
),
'process.env.__NEXT_APP_ISR_INDICATOR': Boolean(
config.devIndicators === false ? false : config.devIndicators.appIsrStatus
),
'process.env.__NEXT_PPR': isPPREnabled,
'process.env.__NEXT_DYNAMIC_IO': isDynamicIOEnabled,
'process.env.__NEXT_USE_CACHE': isUseCacheEnabled,
......@@ -237,10 +234,6 @@ export function getDefineEnv({
}
: {}),
'process.env.__NEXT_TRAILING_SLASH': config.trailingSlash,
'process.env.__NEXT_BUILD_INDICATOR':
config.devIndicators === false
? false
: config.devIndicators.buildActivity ?? true,
'process.env.__NEXT_DEV_INDICATOR': config.devIndicators !== false,
'process.env.__NEXT_DEV_INDICATOR_POSITION':
config.devIndicators === false
......@@ -296,8 +289,6 @@ export function getDefineEnv({
needsExperimentalReact(config),
}
: undefined),
'process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY':
config.experimental.newDevOverlay || false,
}
const userDefines = config.compiler?.define ?? {}
......
......@@ -4,7 +4,7 @@ import type { OverlayState } from '../../../../../shared'
import { useState, useEffect, useRef, createContext, useContext } from 'react'
import { Toast } from '../../toast'
import { NextLogo } from './internal/next-logo'
import { useIsDevBuilding } from '../../../../../../../dev/dev-build-indicator/internal/initialize-for-new-overlay'
import { useIsDevBuilding } from '../../../../../../../dev/dev-build-indicator/internal/initialize'
import { useIsDevRendering } from './internal/dev-render-indicator'
import { useDelayedRender } from '../../../hooks/use-delayed-render'
import { noop as css } from '../../../helpers/noop-template'
......
......@@ -341,10 +341,7 @@ function processMessage(
switch (obj.action) {
case HMR_ACTIONS_SENT_TO_BROWSER.APP_ISR_MANIFEST: {
if (
process.env.__NEXT_APP_ISR_INDICATOR ||
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY
) {
if (process.env.__NEXT_DEV_INDICATOR) {
if (appIsrManifestRef) {
appIsrManifestRef.current = obj.data
......@@ -353,24 +350,7 @@ function processMessage(
// as we'll receive the updated manifest before usePathname
// triggers for new value
if ((pathnameRef.current as string) in obj.data) {
if (process.env.__NEXT_APP_ISR_INDICATOR) {
// the indicator can be hidden for an hour.
// check if it's still hidden
const indicatorHiddenAt = Number(
localStorage?.getItem('__NEXT_DISMISS_PRERENDER_INDICATOR')
)
const isHidden =
indicatorHiddenAt &&
!isNaN(indicatorHiddenAt) &&
Date.now() < indicatorHiddenAt
if (!isHidden) {
dispatcher.onStaticIndicator(true)
}
} else if (process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY) {
dispatcher.onStaticIndicator(true)
}
dispatcher.onStaticIndicator(true)
} else {
dispatcher.onStaticIndicator(false)
}
......@@ -650,10 +630,7 @@ export default function HotReload({
const appIsrManifestRef = useRef<Record<string, false | number>>({})
const pathnameRef = useRef(pathname)
if (
process.env.__NEXT_APP_ISR_INDICATOR ||
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY
) {
if (process.env.__NEXT_DEV_INDICATOR) {
// this conditional is only for dead-code elimination which
// isn't a runtime conditional only build-time so ignore hooks rule
// eslint-disable-next-line react-hooks/rules-of-hooks
......@@ -665,22 +642,7 @@ export default function HotReload({
if (appIsrManifest) {
if (pathname && pathname in appIsrManifest) {
try {
if (process.env.__NEXT_APP_ISR_INDICATOR) {
const indicatorHiddenAt = Number(
localStorage?.getItem('__NEXT_DISMISS_PRERENDER_INDICATOR')
)
const isHidden =
indicatorHiddenAt &&
!isNaN(indicatorHiddenAt) &&
Date.now() < indicatorHiddenAt
if (!isHidden) {
dispatcher.onStaticIndicator(true)
}
} else if (process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY) {
dispatcher.onStaticIndicator(true)
}
dispatcher.onStaticIndicator(true)
} catch (reason) {
let message = ''
......@@ -742,11 +704,7 @@ export default function HotReload({
if (shouldRenderErrorOverlay) {
return (
<ReactDevOverlay
state={state}
dispatcher={dispatcher}
globalError={globalError}
>
<ReactDevOverlay state={state} globalError={globalError}>
{children}
</ReactDevOverlay>
)
......
import React from 'react'
import type { OverlayState } from '../shared'
import { ShadowPortal } from '../internal/components/ShadowPortal'
import { BuildError } from '../internal/container/BuildError'
import { Errors } from '../internal/container/Errors'
import { StaticIndicator } from '../internal/container/StaticIndicator'
import { Base } from '../internal/styles/Base'
import { ComponentStyles } from '../internal/styles/ComponentStyles'
import { CssReset } from '../internal/styles/CssReset'
import { RootLayoutMissingTagsError } from '../internal/container/RootLayoutMissingTagsError'
import type { Dispatcher } from './hot-reloader-client'
import { RuntimeErrorHandler } from '../../errors/runtime-error-handler'
import type { GlobalErrorComponent } from '../../error-boundary'
function ErroredHtml({
globalError: [GlobalError, globalErrorStyles],
error,
}: {
globalError: [GlobalErrorComponent, React.ReactNode]
error: unknown
}) {
if (!error) {
return (
<html>
<head />
<body />
</html>
)
}
return (
<>
{globalErrorStyles}
<GlobalError error={error} />
</>
)
}
interface ReactDevOverlayState {
reactError?: unknown
isReactError: boolean
}
export default class ReactDevOverlay extends React.PureComponent<
{
state: OverlayState
globalError: [GlobalErrorComponent, React.ReactNode]
dispatcher?: Dispatcher
children: React.ReactNode
},
ReactDevOverlayState
> {
state = {
reactError: null,
isReactError: false,
}
static getDerivedStateFromError(error: Error): ReactDevOverlayState {
if (!error.stack) return { isReactError: false }
RuntimeErrorHandler.hadRuntimeError = true
return {
reactError: error,
isReactError: true,
}
}
render() {
const { state, children, dispatcher, globalError } = this.props
const { isReactError, reactError } = this.state
const hasBuildError = state.buildError != null
const hasRuntimeErrors = Boolean(state.errors.length)
const hasStaticIndicator = state.staticIndicator
const debugInfo = state.debugInfo
return (
<>
{isReactError ? (
<ErroredHtml globalError={globalError} error={reactError} />
) : (
children
)}
<ShadowPortal>
<CssReset />
<Base />
<ComponentStyles />
{state.rootLayoutMissingTags?.length ? (
<RootLayoutMissingTagsError
missingTags={state.rootLayoutMissingTags}
/>
) : hasBuildError ? (
<BuildError
message={state.buildError!}
versionInfo={state.versionInfo}
/>
) : (
<>
{hasRuntimeErrors ? (
<Errors
isAppDir={true}
initialDisplayState={
isReactError ? 'fullscreen' : 'minimized'
}
errors={state.errors}
versionInfo={state.versionInfo}
hasStaticIndicator={hasStaticIndicator}
debugInfo={debugInfo}
/>
) : null}
{hasStaticIndicator && (
<StaticIndicator dispatcher={dispatcher} />
)}
</>
)}
</ShadowPortal>
</>
)
}
}
import OldReactDevOverlay from './old-react-dev-overlay'
import NewReactDevOverlay from '../_experimental/app/react-dev-overlay'
export default Boolean(process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY)
? NewReactDevOverlay
: OldReactDevOverlay
export default NewReactDevOverlay
import * as React from 'react'
import { ShadowPortal } from '../internal/components/ShadowPortal'
import { BuildError } from '../internal/container/BuildError'
import { Errors } from '../internal/container/Errors'
import { ErrorBoundary } from './error-boundary'
import { Base } from '../internal/styles/Base'
import { ComponentStyles } from '../internal/styles/ComponentStyles'
import { CssReset } from '../internal/styles/CssReset'
import { usePagesReactDevOverlay } from './hooks'
export type ErrorType = 'runtime' | 'build'
export default function ReactDevOverlay({
children,
}: {
children?: React.ReactNode
}) {
const { hasBuildError, hasRuntimeErrors, state, onComponentError } =
usePagesReactDevOverlay()
const isMounted = hasBuildError || hasRuntimeErrors
return (
<>
<ErrorBoundary onError={onComponentError}>
{children ?? null}
</ErrorBoundary>
{isMounted ? (
<ShadowPortal>
<CssReset />
<Base />
<ComponentStyles />
{hasBuildError ? (
<BuildError
message={state.buildError!}
versionInfo={state.versionInfo}
/>
) : hasRuntimeErrors ? (
<Errors
isAppDir={false}
errors={state.errors}
versionInfo={state.versionInfo}
initialDisplayState={'fullscreen'}
/>
) : undefined}
</ShadowPortal>
) : undefined}
</>
)
}
import OldReactDevOverlay from './old-react-dev-overlay'
import NewReactDevOverlay from '../_experimental/pages/react-dev-overlay'
const ReactDevOverlay = Boolean(process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY)
? NewReactDevOverlay
: OldReactDevOverlay
const ReactDevOverlay = NewReactDevOverlay
export type ReactDevOverlayType = typeof ReactDevOverlay
......
......@@ -2,9 +2,9 @@ import { devBuildIndicator } from './internal/dev-build-indicator'
/** Integrates the generic dev build indicator with the App Router. */
export const initializeDevBuildIndicatorForAppRouter = () => {
if (!process.env.__NEXT_BUILD_INDICATOR) {
if (!process.env.__NEXT_DEV_INDICATOR) {
return
}
devBuildIndicator.initialize(process.env.__NEXT_DEV_INDICATOR_POSITION)
devBuildIndicator.initialize()
}
......@@ -4,11 +4,11 @@ import { handleDevBuildIndicatorHmrEvents } from './internal/handle-dev-build-in
/** Integrates the generic dev build indicator with the Pages Router. */
export const initializeDevBuildIndicatorForPageRouter = () => {
if (!process.env.__NEXT_BUILD_INDICATOR) {
if (!process.env.__NEXT_DEV_INDICATOR) {
return
}
devBuildIndicator.initialize(process.env.__NEXT_DEV_INDICATOR_POSITION)
devBuildIndicator.initialize()
// Add message listener specifically for Pages Router to handle lifecycle events
// related to dev builds (building, built, sync)
......
import { initialize } from './initialize'
const NOOP = () => {}
export const devBuildIndicator = {
......@@ -6,11 +8,5 @@ export const devBuildIndicator = {
/** Hides build indicator when Next.js finishes compiling. Requires initialize() first. */
hide: NOOP,
/** Sets up the build indicator UI component. Call this before using show/hide. */
initialize: process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY
? (
require('./initialize-for-new-overlay') as typeof import('./initialize-for-new-overlay')
).initializeForNewOverlay
: (
require('./initialize-for-old-overlay') as typeof import('./initialize-for-old-overlay')
).initializeForOldOverlay,
initialize,
}
/*
* Initializes the build indicator for the old overlay
* This is a singleton store to track whether the app is currently being built
* Used by the dev tools indicator of the old overlay to show build status
*/
import { devBuildIndicator } from './dev-build-indicator'
type VerticalPosition = 'top' | 'bottom'
type HorizonalPosition = 'left' | 'right'
export function initializeForOldOverlay(position = 'bottom-right') {
const shadowHost = document.createElement('div')
const [verticalProperty, horizontalProperty] = position.split('-', 2) as [
VerticalPosition,
HorizonalPosition,
]
shadowHost.id = '__next-build-indicator'
// Make sure container is fixed and on a high zIndex so it shows
shadowHost.style.position = 'fixed'
// Ensure container's position to be top or bottom (default)
shadowHost.style[verticalProperty] = '10px'
// Ensure container's position to be left or right (default)
shadowHost.style[horizontalProperty] = '20px'
shadowHost.style.width = '0'
shadowHost.style.height = '0'
shadowHost.style.zIndex = '99999'
document.body.appendChild(shadowHost)
let shadowRoot
let prefix = ''
if (shadowHost.attachShadow) {
shadowRoot = shadowHost.attachShadow({ mode: 'open' })
} else {
// If attachShadow is undefined then the browser does not support
// the Shadow DOM, we need to prefix all the names so there
// will be no conflicts
shadowRoot = shadowHost
prefix = '__next-build-indicator-'
}
// Container
const container = createContainer(prefix)
shadowRoot.appendChild(container)
// CSS
const css = createCss(prefix, { horizontalProperty, verticalProperty })
shadowRoot.appendChild(css)
// State
let isVisible = false
let isBuilding = false
let timeoutId: null | ReturnType<typeof setTimeout> = null
devBuildIndicator.show = () => {
timeoutId && clearTimeout(timeoutId)
isVisible = true
isBuilding = true
updateContainer()
}
devBuildIndicator.hide = () => {
isBuilding = false
// Wait for the fade out transition to complete
timeoutId = setTimeout(() => {
isVisible = false
updateContainer()
}, 100)
updateContainer()
}
function updateContainer() {
if (isBuilding) {
container.classList.add(`${prefix}building`)
} else {
container.classList.remove(`${prefix}building`)
}
if (isVisible) {
container.classList.add(`${prefix}visible`)
} else {
container.classList.remove(`${prefix}visible`)
}
}
}
function createContainer(prefix: string) {
const container = document.createElement('div')
container.id = `${prefix}container`
container.innerHTML = `
<div id="${prefix}icon-wrapper">
<svg viewBox="0 0 226 200">
<defs>
<linearGradient
x1="114.720775%"
y1="181.283245%"
x2="39.5399306%"
y2="100%"
id="${prefix}linear-gradient"
>
<stop stop-color="#000000" offset="0%" />
<stop stop-color="#FFFFFF" offset="100%" />
</linearGradient>
</defs>
<g id="${prefix}icon-group" fill="none" stroke="url(#${prefix}linear-gradient)" stroke-width="18">
<path d="M113,5.08219117 L4.28393801,197.5 L221.716062,197.5 L113,5.08219117 Z" />
</g>
</svg>
</div>
`
return container
}
function createCss(
prefix: string,
{
horizontalProperty,
verticalProperty,
}: { horizontalProperty: string; verticalProperty: string }
) {
const css = document.createElement('style')
css.textContent = `
#${prefix}container {
position: absolute;
${verticalProperty}: 10px;
${horizontalProperty}: 30px;
border-radius: 3px;
background: #000;
color: #fff;
font: initial;
cursor: initial;
letter-spacing: initial;
text-shadow: initial;
text-transform: initial;
visibility: initial;
padding: 7px 10px 8px 10px;
align-items: center;
box-shadow: 0 11px 40px 0 rgba(0, 0, 0, 0.25), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
display: none;
opacity: 0;
transition: opacity 0.1s ease, ${verticalProperty} 0.1s ease;
animation: ${prefix}fade-in 0.1s ease-in-out;
}
#${prefix}container.${prefix}visible {
display: flex;
}
#${prefix}container.${prefix}building {
${verticalProperty}: 20px;
opacity: 1;
}
#${prefix}icon-wrapper {
width: 16px;
height: 16px;
}
#${prefix}icon-wrapper > svg {
width: 100%;
height: 100%;
}
#${prefix}icon-group {
animation: ${prefix}strokedash 1s ease-in-out both infinite;
}
@keyframes ${prefix}fade-in {
from {
${verticalProperty}: 10px;
opacity: 0;
}
to {
${verticalProperty}: 20px;
opacity: 1;
}
}
@keyframes ${prefix}strokedash {
0% {
stroke-dasharray: 0 226;
}
80%,
100% {
stroke-dasharray: 659 226;
}
}
`
return css
}
......@@ -22,7 +22,7 @@ export function useIsDevBuilding() {
return useSyncExternalStore(subscribe, getSnapshot)
}
export function initializeForNewOverlay() {
export function initialize() {
devBuildIndicator.show = () => {
isVisible = true
listeners.forEach((listener) => listener())
......
......@@ -230,8 +230,6 @@ export const configSchema: zod.ZodType<NextConfig> = z.lazy(() =>
devIndicators: z
.union([
z.object({
appIsrStatus: z.boolean().optional(),
buildActivity: z.boolean().optional(),
buildActivityPosition: z
.union([
z.literal('bottom-left'),
......@@ -266,7 +264,6 @@ export const configSchema: zod.ZodType<NextConfig> = z.lazy(() =>
nodeMiddleware: z.boolean().optional(),
after: z.boolean().optional(),
appDocumentPreloading: z.boolean().optional(),
appIsrStatus: z.boolean().optional(),
appNavFailHandling: z.boolean().optional(),
preloadEntriesOnStart: z.boolean().optional(),
allowedRevalidateHeaderKeys: z.array(z.string()).optional(),
......
......@@ -469,14 +469,14 @@ function assignDefaults(
warnOptionHasBeenDeprecated(
result,
'devIndicators.appIsrStatus',
`\`devIndicators.appIsrStatus\` is no longer needed and is enabled by default. You can remove it from ${configFileName}.`,
`\`devIndicators.appIsrStatus\` is deprecated and no longer configurable. Please remove it from ${configFileName}.`,
silent
)
warnOptionHasBeenDeprecated(
result,
'devIndicators.buildActivity',
`\`devIndicators.buildActivity\` is no longer needed and is enabled by default. You can remove it from ${configFileName}.`,
`\`devIndicators.buildActivity\` is deprecated and no longer configurable. Please remove it from ${configFileName}.`,
silent
)
......@@ -955,24 +955,8 @@ function assignDefaults(
result.experimental = {}
}
// TODO(jiwon): remove once we've made new UI default
if (process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'false') {
result.experimental.newDevOverlay = false
}
// Preserve the default indicator options for old overlay.
if (result.experimental.newDevOverlay !== true) {
result.devIndicators = {
...result.devIndicators,
appIsrStatus:
result.devIndicators === false
? false
: result.devIndicators?.appIsrStatus ?? true,
buildActivity:
result.devIndicators === false
? false
: result.devIndicators?.buildActivity ?? true,
}
// If the user didn't explicitly set `position` or `buildActivityPosition` option,
// the default is going to be "bottom-left". However, the default position for the
// old build activity indicator was "bottom-right" which becomes a breaking change.
......@@ -980,9 +964,10 @@ function assignDefaults(
if (!hasWarnedBuildActivityPosition) {
result.devIndicators = {
...result.devIndicators,
position: userConfig.devIndicators?.position
? result.devIndicators.position
: 'bottom-right',
position:
userConfig.devIndicators?.position && result.devIndicators !== false
? result.devIndicators?.position
: 'bottom-right',
}
}
}
......
......@@ -50,12 +50,6 @@ const ENDGROUP = process.env.CI ? '##[endgroup]' : ''
const externalTestsFilter = getTestFilter()
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
if (!process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY) {
console.log('Setting __NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY to true')
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY = 'true'
}
const timings = []
const DEFAULT_NUM_RETRIES = 2
const DEFAULT_CONCURRENCY = 2
......
......@@ -32,14 +32,8 @@ describe('dynamic = "error" in devmode', () => {
const { session } = sandbox
await session.assertHasRedbox()
const description = await session.getRedboxDescription()
if (process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true') {
expect(description).toMatchInlineSnapshot(
`"Error: Route /server with \`dynamic = "error"\` couldn't be rendered statically because it used \`cookies\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering"`
)
} else {
expect(description).toMatchInlineSnapshot(
`"[ Server ] Error: Route /server with \`dynamic = "error"\` couldn't be rendered statically because it used \`cookies\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering"`
)
}
expect(description).toMatchInlineSnapshot(
`"Error: Route /server with \`dynamic = "error"\` couldn't be rendered statically because it used \`cookies\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering"`
)
})
})
......@@ -65,24 +65,19 @@ describe('Error overlay - editor links', () => {
`
)
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
// Ensure the Next Logo is not loading. This is to assert that the build did stop.
if (isNewDevOverlay) {
await retry(async () => {
const loaded = await browser.eval(() => {
return Boolean(
[].slice
.call(document.querySelectorAll('nextjs-portal'))
.find((p) =>
p.shadowRoot.querySelector('[data-next-mark-loading="false"]')
)
)
})
expect(loaded).toBe(true)
await retry(async () => {
const loaded = await browser.eval(() => {
return Boolean(
[].slice
.call(document.querySelectorAll('nextjs-portal'))
.find((p) =>
p.shadowRoot.querySelector('[data-next-mark-loading="false"]')
)
)
})
}
expect(loaded).toBe(true)
})
await session.assertHasRedbox()
await clickSourceFile(browser)
......
......@@ -215,7 +215,7 @@ describe('Error overlay for hydration errors in App router', () => {
expect(pseudoHtml).toMatchInlineSnapshot(`
"...
<HotReload assetPrefix="" globalError={[...]}>
<ReactDevOverlay state={{nextId:1, ...}} dispatcher={{...}} globalError={[...]}>
<ReactDevOverlay state={{nextId:1, ...}} globalError={[...]}>
<DevOverlayErrorBoundary devOverlay={<Fragment>} globalError={[...]} onError={function bound dispatchSetState}>
<DevRootHTTPAccessFallbackBoundary>
<HTTPAccessFallbackBoundary notFound={<NotAllowedRootHTTPFallbackError>}>
......@@ -238,7 +238,7 @@ describe('Error overlay for hydration errors in App router', () => {
expect(pseudoHtml).toMatchInlineSnapshot(`
"...
<HotReload assetPrefix="" globalError={[...]}>
<ReactDevOverlay state={{nextId:1, ...}} dispatcher={{...}} globalError={[...]}>
<ReactDevOverlay state={{nextId:1, ...}} globalError={[...]}>
<DevOverlayErrorBoundary devOverlay={<Fragment>} globalError={[...]} onError={function bound dispatchSetState}>
<DevRootHTTPAccessFallbackBoundary>
<HTTPAccessFallbackBoundary notFound={<NotAllowedRootHTTPFallbackError>}>
......
......@@ -8,9 +8,6 @@ import {
getVersionCheckerText,
} from 'next-test-utils'
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
describe('Error overlay - RSC runtime errors', () => {
const { next } = nextTestSetup({
files: new FileRef(path.join(__dirname, 'fixtures', 'rsc-runtime-errors')),
......@@ -111,11 +108,7 @@ describe('Error overlay - RSC runtime errors', () => {
await assertHasRedbox(browser)
const versionText = await getVersionCheckerText(browser)
if (isNewDevOverlay) {
expect(versionText).toMatch(/Next.js [\w.-]+/)
} else {
expect(versionText).toMatch(/Next.js \([\w.-]+\)/)
}
expect(versionText).toMatch(/Next.js [\w.-]+/)
})
it('should not show the bundle layer info in the file trace', async () => {
......
......@@ -11,9 +11,6 @@ function getStaleness(browser: BrowserInterface) {
.text()
}
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
describe('Error Overlay version staleness', () => {
const { next } = nextTestSetup({
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
......@@ -50,28 +47,15 @@ describe('Error Overlay version staleness', () => {
await session.openRedbox()
if (isNewDevOverlay) {
if (process.env.TURBOPACK) {
expect(await getStaleness(browser)).toMatchInlineSnapshot(`
if (process.env.TURBOPACK) {
expect(await getStaleness(browser)).toMatchInlineSnapshot(`
"Next.js 1.0.0 (outdated)
Turbopack"
`)
} else {
expect(await getStaleness(browser)).toMatchInlineSnapshot(
`"Next.js 1.0.0 (outdated)"`
)
}
} else {
if (process.env.TURBOPACK) {
expect(await getStaleness(browser)).toMatchInlineSnapshot(`
"Next.js 1.0.0 (outdated)
Turbopack"
`)
} else {
expect(await getStaleness(browser)).toMatchInlineSnapshot(
`"Next.js 1.0.0 (outdated)"`
)
}
expect(await getStaleness(browser)).toMatchInlineSnapshot(
`"Next.js 1.0.0 (outdated)"`
)
}
})
......
......@@ -5,9 +5,6 @@ import { outdent } from 'outdent'
import { getRedboxTotalErrorCount, retry } from 'next-test-utils'
const isReact18 = parseInt(process.env.NEXT_TEST_REACT_VERSION) === 18
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
// https://github.com/facebook/react/blob/main/packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js used as a reference
describe('Error overlay for hydration errors in Pages router', () => {
......@@ -489,11 +486,6 @@ describe('Error overlay for hydration errors in Pages router', () => {
)
const { session, browser } = sandbox
// in the new overlay, `assertHasRedbox` is redundant with `hasErrorToast`
if (!isNewDevOverlay) {
await expect(session.hasErrorToast()).resolves.toBe(false)
}
await session.assertHasRedbox()
if (isReact18) {
......
import { nextTestSetup } from 'e2e-utils'
import { assertNoRedbox, assertNoConsoleErrors } from 'next-test-utils'
const isNewOverlay = process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY !== 'false'
describe('app-dir - capture-console-error-owner-stack', () => {
const { next } = nextTestSetup({
files: __dirname,
......@@ -109,8 +107,7 @@ describe('app-dir - capture-console-error-owner-stack', () => {
it('should be able to capture rsc logged error', async () => {
const browser = await next.browser('/rsc')
if (isNewOverlay) {
await expect(browser).toDisplayCollapsedRedbox(`
await expect(browser).toDisplayCollapsedRedbox(`
{
"count": 1,
"description": "Error: boom",
......@@ -126,24 +123,6 @@ describe('app-dir - capture-console-error-owner-stack', () => {
],
}
`)
} else {
await expect(browser).toDisplayCollapsedRedbox(`
{
"count": 1,
"description": "[ Server ] Error: boom",
"environmentLabel": null,
"label": "Console Error",
"source": "app/rsc/page.js (2:17) @ Page
> 2 | console.error(new Error('boom'))
| ^",
"stack": [
"Page app/rsc/page.js (2:17)",
"JSON.parse <anonymous> (0:0)",
"Page <anonymous> (0:0)",
],
}
`)
}
})
it('should display the error message in error event when event.error is not present', async () => {
......
import { nextTestSetup } from 'e2e-utils'
import { getRouteTypeFromDevToolsIndicator, retry } from 'next-test-utils'
import { BrowserInterface } from 'next-webdriver'
describe('prerender indicator', () => {
describe('dev indicator - route type', () => {
const { next } = nextTestSetup({
files: __dirname,
})
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
async function hasStaticIndicator(browser: BrowserInterface) {
if (isNewDevOverlay) {
const routeType = await getRouteTypeFromDevToolsIndicator(browser)
console.log({ routeType })
return routeType === 'Static'
}
const staticIndicatorPresent = await browser.eval(() =>
Boolean(
document
.querySelector('nextjs-portal')
.shadowRoot.querySelector('.nextjs-static-indicator-toast-wrapper')
)
)
return staticIndicatorPresent
}
it('should have prerender-indicator by default for static page', async () => {
it('should have route type as static by default for static page', async () => {
const browser = await next.browser('/')
await retry(async () => {
expect(await hasStaticIndicator(browser)).toBe(true)
expect(await getRouteTypeFromDevToolsIndicator(browser)).toBe('Static')
})
})
it('should hide the indicator when changing to dynamic', async () => {
it('should have route type as dynamic when changing to dynamic page', async () => {
const browser = await next.browser('/')
const origContent = await next.readFile('app/page.tsx')
......@@ -46,14 +25,14 @@ describe('prerender indicator', () => {
try {
await retry(async () => {
expect(await hasStaticIndicator(browser)).toBe(false)
expect(await getRouteTypeFromDevToolsIndicator(browser)).toBe('Dynamic')
})
} finally {
await next.patchFile('app/page.tsx', origContent)
}
})
it('should not have the indicator on dynamic page on load', async () => {
it('should have route type as dynamic when on load of dynamic page', async () => {
const origContent = await next.readFile('app/page.tsx')
await next.patchFile(
......@@ -65,44 +44,18 @@ describe('prerender indicator', () => {
try {
await retry(async () => {
expect(await hasStaticIndicator(browser)).toBe(false)
expect(await getRouteTypeFromDevToolsIndicator(browser)).toBe('Dynamic')
})
} finally {
await next.patchFile('app/page.tsx', origContent)
}
})
// TODO(jiwon): The new UI will always show the route type.
if (!isNewDevOverlay) {
it.skip('should not show the indicator if disabled in next.config', async () => {
await next.stop()
await next.patchFile(
'next.config.js',
`
module.exports = {
devIndicators: {
appIsrStatus: false
}
}
`
)
try {
await next.start()
const browser = await next.browser('/')
expect(await hasStaticIndicator(browser)).toBe(false)
} finally {
await next.deleteFile('app/page.tsx')
}
})
}
it('should not have static indicator when using force-dynamic', async () => {
it('should have route type as dynamic when using force-dynamic', async () => {
const browser = await next.browser('/force-dynamic')
await browser.waitForElementByCss('#ready')
expect(await hasStaticIndicator(browser)).toBe(false)
expect(await getRouteTypeFromDevToolsIndicator(browser)).toBe('Dynamic')
})
})
......@@ -9,14 +9,10 @@ describe('Dynamic IO Dev Errors', () => {
files: __dirname,
})
const isNewOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY !== 'false'
it('should show a red box error on the SSR render', async () => {
const browser = await next.browser('/error')
if (isNewOverlay) {
await expect(browser).toDisplayCollapsedRedbox(`
await expect(browser).toDisplayCollapsedRedbox(`
{
"count": 1,
"description": "Error: Route "/error" used \`Math.random()\` outside of \`"use cache"\` and without explicitly calling \`await connection()\` beforehand. See more info here: https://nextjs.org/docs/messages/next-prerender-random",
......@@ -32,24 +28,6 @@ describe('Dynamic IO Dev Errors', () => {
],
}
`)
} else {
await expect(browser).toDisplayCollapsedRedbox(`
{
"count": 1,
"description": "[ Server ] Error: Route "/error" used \`Math.random()\` outside of \`"use cache"\` and without explicitly calling \`await connection()\` beforehand. See more info here: https://nextjs.org/docs/messages/next-prerender-random",
"environmentLabel": null,
"label": "Console Error",
"source": "app/error/page.tsx (2:23) @ Page
> 2 | const random = Math.random()
| ^",
"stack": [
"Page app/error/page.tsx (2:23)",
"JSON.parse <anonymous> (0:0)",
"<unknown> <anonymous> (0:0)",
],
}
`)
}
})
it('should show a red box error on client navigations', async () => {
......@@ -61,8 +39,7 @@ describe('Dynamic IO Dev Errors', () => {
await browser.elementByCss("[href='/error']").click()
if (isNewOverlay) {
await expect(browser).toDisplayCollapsedRedbox(`
await expect(browser).toDisplayCollapsedRedbox(`
{
"count": 1,
"description": "Error: Route "/error" used \`Math.random()\` outside of \`"use cache"\` and without explicitly calling \`await connection()\` beforehand. See more info here: https://nextjs.org/docs/messages/next-prerender-random",
......@@ -78,24 +55,6 @@ describe('Dynamic IO Dev Errors', () => {
],
}
`)
} else {
await expect(browser).toDisplayCollapsedRedbox(`
{
"count": 1,
"description": "[ Server ] Error: Route "/error" used \`Math.random()\` outside of \`"use cache"\` and without explicitly calling \`await connection()\` beforehand. See more info here: https://nextjs.org/docs/messages/next-prerender-random",
"environmentLabel": null,
"label": "Console Error",
"source": "app/error/page.tsx (2:23) @ Page
> 2 | const random = Math.random()
| ^",
"stack": [
"Page app/error/page.tsx (2:23)",
"JSON.parse <anonymous> (0:0)",
"<unknown> <anonymous> (0:0)",
],
}
`)
}
})
it('should not log unhandled rejections for persistently thrown top-level errors', async () => {
......@@ -141,8 +100,7 @@ describe('Dynamic IO Dev Errors', () => {
'\n at InnerLayoutRouter (..')
)
if (isNewOverlay) {
await expect(browser).toDisplayCollapsedRedbox(`
await expect(browser).toDisplayCollapsedRedbox(`
{
"count": 1,
"description": "Error: Route "/no-accessed-data": A component accessed data, headers, params, searchParams, or a short-lived cache without a Suspense boundary nor a "use cache" above it. We don't have the exact line number added to error messages yet but you can see which component in the stack below. See more info: https://nextjs.org/docs/messages/next-prerender-missing-suspense",
......@@ -160,26 +118,6 @@ describe('Dynamic IO Dev Errors', () => {
],
}
`)
} else {
await expect(browser).toDisplayCollapsedRedbox(`
{
"count": 1,
"description": "[ Server ] Error: Route "/no-accessed-data": A component accessed data, headers, params, searchParams, or a short-lived cache without a Suspense boundary nor a "use cache" above it. We don't have the exact line number added to error messages yet but you can see which component in the stack below. See more info: https://nextjs.org/docs/messages/next-prerender-missing-suspense",
"environmentLabel": null,
"label": "Console Error",
"source": undefined,
"stack": [
"Page [Server] <anonymous> (2:1)",
"main <anonymous> (2:1)",
"body <anonymous> (2:1)",
"html <anonymous> (2:1)",
"Root [Server] <anonymous> (2:1)",
"JSON.parse <anonymous> (0:0)",
"<unknown> <anonymous> (0:0)",
],
}
`)
}
})
it('should clear segment errors after correcting them', async () => {
......@@ -201,8 +139,7 @@ describe('Dynamic IO Dev Errors', () => {
)
const { browser, session } = sandbox
if (isTurbopack) {
if (isNewOverlay) {
await expect(browser).toDisplayRedbox(`
await expect(browser).toDisplayRedbox(`
{
"count": 1,
"description": "Failed to compile",
......@@ -215,21 +152,6 @@ describe('Dynamic IO Dev Errors', () => {
"stack": [],
}
`)
} else {
await expect(browser).toDisplayRedbox(`
{
"count": 1,
"description": "Failed to compile",
"environmentLabel": null,
"label": "Build Error",
"source": "./app/page.tsx:1:14
Ecmascript file had an error
> 1 | export const revalidate = 10
| ^^^^^^^^^^",
"stack": [],
}
`)
}
} else {
await expect(browser).toDisplayRedbox(`
{
......
......@@ -11,8 +11,6 @@ describe('error-ignored-frames', () => {
})
if (
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true' ||
// Skip react 18 test as the call stacks are different
process.env.NEXT_TEST_REACT_VERSION === '18.3.1'
) {
......@@ -108,8 +106,8 @@ describe('error-ignored-frames', () => {
} else {
expect(expendedStack).toMatchInlineSnapshot(`
"at eval (app/interleaved/page.tsx (7:11))
at invokeCallback (node_modules/interleave/index.js (2:1))
at Page (app/interleaved/page.tsx (6:36))
at invokeCallback (node_modules/interleave/index.js (2:1))
at ClientPageRoot (../src/client/components/client-page.tsx (60:12))"
`)
}
......
export default function Layout({ children }) {
return <body>{children}</body>
}
export default function Page() {
return <p>hello world</p>
}
import { nextTestSetup } from 'e2e-utils'
import {
assertHasRedbox,
assertNoRedbox,
getRedboxDescription,
getToastErrorCount,
hasErrorToast,
retry,
} from 'next-test-utils'
import { outdent } from 'outdent'
// TODO(new-dev-overlay): merge with test/development/app-dir/missing-required-html-tags/index.test.ts
// once new overlay is stable
const isDisabled = process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'false'
;(isDisabled ? describe.skip : describe)(
'app-dir - missing required html tags',
() => {
const { next } = nextTestSetup({
files: __dirname,
})
it('should display correct error count in dev indicator', async () => {
const browser = await next.browser('/')
retry(async () => {
expect(await hasErrorToast(browser)).toBe(true)
})
// Dev indicator should show 1 error
expect(await getToastErrorCount(browser)).toBe(1)
await assertHasRedbox(browser)
await retry(async () => {
expect(await getRedboxDescription(browser)).toEqual(outdent`
The following tags are missing in the Root Layout: <html>.
Read more at https://nextjs.org/docs/messages/missing-root-layout-tags
`)
})
await next.patchFile('app/layout.js', (code) =>
code.replace(
'return <body>{children}</body>',
'return <html><body>{children}</body></html>'
)
)
await assertNoRedbox(browser)
expect(await browser.elementByCss('p').text()).toBe('hello world')
})
}
)
/**
* @type {import('next').NextConfig}
*/
module.exports = {
experimental: {
newDevOverlay: true,
},
}
......@@ -3,6 +3,8 @@ import {
assertHasRedbox,
assertNoRedbox,
getRedboxDescription,
getToastErrorCount,
hasErrorToast,
retry,
} from 'next-test-utils'
import { outdent } from 'outdent'
......@@ -10,6 +12,16 @@ import { outdent } from 'outdent'
describe('app-dir - missing required html tags', () => {
const { next } = nextTestSetup({ files: __dirname })
it('should display correct error count in dev indicator', async () => {
const browser = await next.browser('/')
retry(async () => {
expect(await hasErrorToast(browser)).toBe(true)
})
// Dev indicator should show 1 error
expect(await getToastErrorCount(browser)).toBe(1)
})
it('should show error overlay', async () => {
const browser = await next.browser('/')
......
......@@ -51,9 +51,6 @@ describe('app-dir - owner-stack', () => {
files: __dirname,
})
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
it('should log stitched error for browser uncaught errors', async () => {
const browser = await next.browser('/browser/uncaught')
......@@ -71,10 +68,8 @@ describe('app-dir - owner-stack', () => {
return log.message.includes('Error: browser error')
}).message
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
if (isNewDevOverlay) {
if (process.env.TURBOPACK) {
expect(normalizeStackTrace(errorLog)).toMatchInlineSnapshot(`
if (process.env.TURBOPACK) {
expect(normalizeStackTrace(errorLog)).toMatchInlineSnapshot(`
"%o
%s Error: browser error
at useThrowError
......@@ -92,48 +87,8 @@ describe('app-dir - owner-stack', () => {
at performWorkOnRootViaSchedulerTask
at MessagePort.performWorkUntilDeadline The above error occurred in the <Page> component. It was handled by the <DevOverlayErrorBoundary> error boundary."
`)
} else {
expect(normalizeStackTrace(errorLog)).toMatchInlineSnapshot(`
"%o
%s Error: browser error
at useThrowError
at useErrorHook
at Page
at react-stack-bottom-frame
at renderWithHooks
at updateFunctionComponent
at beginWork
at runWithFiberInDEV
at performUnitOfWork
at workLoopSync
at renderRootSync
at performWorkOnRoot
at performWorkOnRootViaSchedulerTask
at MessagePort.performWorkUntilDeadline The above error occurred in the <Page> component. It was handled by the <DevOverlayErrorBoundary> error boundary."
`)
}
} else {
if (process.env.TURBOPACK) {
expect(normalizeStackTrace(errorLog)).toMatchInlineSnapshot(`
"%o
%s Error: browser error
at useThrowError
at useErrorHook
at Page
at react-stack-bottom-frame
at renderWithHooks
at updateFunctionComponent
at beginWork
at runWithFiberInDEV
at performUnitOfWork
at workLoopSync
at renderRootSync
at performWorkOnRoot
at performWorkOnRootViaSchedulerTask
at MessagePort.performWorkUntilDeadline The above error occurred in the <Page> component. It was handled by the <ReactDevOverlay> error boundary."
`)
} else {
expect(normalizeStackTrace(errorLog)).toMatchInlineSnapshot(`
expect(normalizeStackTrace(errorLog)).toMatchInlineSnapshot(`
"%o
%s Error: browser error
at useThrowError
......@@ -149,9 +104,8 @@ describe('app-dir - owner-stack', () => {
at renderRootSync
at performWorkOnRoot
at performWorkOnRootViaSchedulerTask
at MessagePort.performWorkUntilDeadline The above error occurred in the <Page> component. It was handled by the <ReactDevOverlay> error boundary."
at MessagePort.performWorkUntilDeadline The above error occurred in the <Page> component. It was handled by the <DevOverlayErrorBoundary> error boundary."
`)
}
}
})
......@@ -214,8 +168,7 @@ describe('app-dir - owner-stack', () => {
return log.message.includes('Error: ssr error')
}).message
if (isNewDevOverlay) {
expect(normalizeStackTrace(errorLog)).toMatchInlineSnapshot(`
expect(normalizeStackTrace(errorLog)).toMatchInlineSnapshot(`
"%o
%s Error: ssr error
at useThrowError
......@@ -233,26 +186,6 @@ describe('app-dir - owner-stack', () => {
at performWorkOnRootViaSchedulerTask
at MessagePort.performWorkUntilDeadline The above error occurred in the <Page> component. It was handled by the <DevOverlayErrorBoundary> error boundary."
`)
} else {
expect(normalizeStackTrace(errorLog)).toMatchInlineSnapshot(`
"%o
%s Error: ssr error
at useThrowError
at useErrorHook
at Page
at react-stack-bottom-frame
at renderWithHooks
at updateFunctionComponent
at beginWork
at runWithFiberInDEV
at performUnitOfWork
at workLoopSync
at renderRootSync
at performWorkOnRoot
at performWorkOnRootViaSchedulerTask
at MessagePort.performWorkUntilDeadline The above error occurred in the <Page> component. It was handled by the <ReactDevOverlay> error boundary."
`)
}
})
it('should capture unhandled promise rejections', async () => {
......
......@@ -15,16 +15,9 @@ describe('serialize-circular-error', () => {
await assertHasRedbox(browser)
const description = await getRedboxDescription(browser)
// React cannot serialize thrown objects with circular references
if (process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true') {
expect(description).toBe(
`Error: An error occurred but serializing the error message failed.`
)
} else {
expect(description).toBe(
`[ Server ] Error: An error occurred but serializing the error message failed.`
)
}
expect(description).toBe(
`Error: An error occurred but serializing the error message failed.`
)
const output = next.cliOutput
expect(output).toContain(
......
......@@ -5,10 +5,6 @@ import {
getRedboxSource,
} from 'next-test-utils'
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
describe('app-dir - server-component-next-dynamic-ssr-false', () => {
const { next } = nextTestSetup({
files: __dirname,
......@@ -24,10 +20,8 @@ describe('app-dir - server-component-next-dynamic-ssr-false', () => {
expect(redbox.description).toBe('Failed to compile')
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
if (isNewDevOverlay) {
if (process.env.TURBOPACK) {
expect(redbox.source).toMatchInlineSnapshot(`
if (process.env.TURBOPACK) {
expect(redbox.source).toMatchInlineSnapshot(`
"./app/page.js (3:23)
Ecmascript file had an error
1 | import dynamic from 'next/dynamic'
......@@ -40,8 +34,8 @@ describe('app-dir - server-component-next-dynamic-ssr-false', () => {
\`ssr: false\` is not allowed with \`next/dynamic\` in Server Components. Please move it into a client component."
`)
} else {
expect(redbox.source).toMatchInlineSnapshot(`
} else {
expect(redbox.source).toMatchInlineSnapshot(`
"./app/page.js
Error: x \`ssr: false\` is not allowed with \`next/dynamic\` in Server Components. Please move it into a client component.
,-[3:1]
......@@ -54,37 +48,6 @@ describe('app-dir - server-component-next-dynamic-ssr-false', () => {
6 | return <DynamicClient />
\`----"
`)
}
} else {
if (process.env.TURBOPACK) {
expect(redbox.source).toMatchInlineSnapshot(`
"./app/page.js (3:23)
Ecmascript file had an error
1 | import dynamic from 'next/dynamic'
2 |
> 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 {
expect(redbox.source).toMatchInlineSnapshot(`
"./app/page.js
Error: x \`ssr: false\` is not allowed with \`next/dynamic\` in Server Components. Please move it into a client component.
,-[3:1]
1 | import dynamic from 'next/dynamic'
2 |
3 | const DynamicClient = dynamic(() => import('./client'), { ssr: false })
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 |
5 | export default function Page() {
6 | return <DynamicClient />
\`----"
`)
}
}
})
})
......@@ -7,8 +7,6 @@ import {
getRedboxSource,
} from 'next-test-utils'
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
const isReactExperimental = process.env.__NEXT_EXPERIMENTAL_PPR === 'true'
const isReact18 = parseInt(process.env.NEXT_TEST_REACT_VERSION) === 18
......@@ -396,9 +394,7 @@ describe('react-dom/server in React Server environment', () => {
}
`)
} else {
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
if (isNewDevOverlay) {
expect(redbox).toMatchInlineSnapshot(`
expect(redbox).toMatchInlineSnapshot(`
{
"description": "Failed to compile",
"source": "./app/exports/app-code/react-dom-server-node-implicit/page.js
......@@ -422,32 +418,6 @@ describe('react-dom/server in React Server environment', () => {
\`----",
}
`)
} else {
expect(redbox).toMatchInlineSnapshot(`
{
"description": "Failed to compile",
"source": "./app/exports/app-code/react-dom-server-node-implicit/page.js
Error: x 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
,-[1:1]
1 | import * as ReactDOMServerNode from 'react-dom/server'
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 | // Fine to drop once React is on ESM
3 | import ReactDOMServerNodeDefault from 'react-dom/server'
\`----
x 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
,-[3:1]
1 | import * as ReactDOMServerNode from 'react-dom/server'
2 | // Fine to drop once React is on ESM
3 | import ReactDOMServerNodeDefault from 'react-dom/server'
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 |
5 | export const runtime = 'nodejs'
\`----",
}
`)
}
}
})
......
......@@ -11,13 +11,8 @@ import {
} from 'next-test-utils'
import { NextInstance } from 'e2e-utils'
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
const installCheckVisible = (browser) => {
if (isNewDevOverlay) {
return browser.eval(`(function() {
return browser.eval(`(function() {
window.checkInterval = setInterval(function() {
const root = document.querySelector('nextjs-portal').shadowRoot;
const indicator = root.querySelector('[data-next-mark]')
......@@ -27,18 +22,6 @@ const installCheckVisible = (browser) => {
if (window.showedBuilder) clearInterval(window.checkInterval)
}, 50)
})()`)
} else {
return browser.eval(`(function() {
window.checkInterval = setInterval(function() {
let watcherDiv = document.querySelector('#__next-build-indicator')
watcherDiv = watcherDiv.shadowRoot || watcherDiv
window.showedBuilder = window.showedBuilder || (
watcherDiv.querySelector('div').className.indexOf('visible') > -1
)
if (window.showedBuilder) clearInterval(window.checkInterval)
}, 50)
})()`)
}
}
describe('GS(S)P Server-Side Change Reloading', () => {
......
......@@ -13,9 +13,6 @@ describe('app-dir - error-on-next-codemod-comment', () => {
skipDeployment: true,
})
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
if (isNextDev) {
beforeAll(async () => {
await next.start()
......@@ -26,10 +23,8 @@ describe('app-dir - error-on-next-codemod-comment', () => {
await assertHasRedbox(browser)
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
if (isNewDevOverlay) {
if (process.env.TURBOPACK) {
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
if (process.env.TURBOPACK) {
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
"./app/page.tsx (2:2)
Ecmascript file had an error
1 | export default function Page() {
......@@ -42,8 +37,8 @@ describe('app-dir - error-on-next-codemod-comment', () => {
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."
`)
} else {
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
} else {
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
"./app/page.tsx
Error: x 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
......@@ -57,38 +52,6 @@ describe('app-dir - error-on-next-codemod-comment', () => {
4 | }
\`----"
`)
}
} else {
if (process.env.TURBOPACK) {
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
"./app/page.tsx (2:2)
Ecmascript file had an error
1 | export default function Page() {
> 2 | // @next-codemod-error remove jsx of next line
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3 | return <p>hello world</p>
4 | }
5 |
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."
`)
} else {
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
"./app/page.tsx
Error: x 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.
|
,-[2:1]
1 | export default function Page() {
2 | // @next-codemod-error remove jsx of next line
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3 | return <p>hello world</p>
4 | }
\`----"
`)
}
}
})
......
......@@ -6,9 +6,6 @@ describe('app dir - global error', () => {
files: __dirname,
})
const isNewOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
it('should trigger error component when an error happens during rendering', async () => {
const browser = await next.browser('/client')
await browser
......@@ -33,13 +30,7 @@ describe('app dir - global error', () => {
if (isNextDev) {
await assertHasRedbox(browser)
const description = await getRedboxDescription(browser)
if (isNewOverlay) {
expect(description).toMatchInlineSnapshot(`"Error: server page error"`)
} else {
expect(description).toMatchInlineSnapshot(
`"[ Server ] Error: server page error"`
)
}
expect(description).toMatchInlineSnapshot(`"Error: server page error"`)
}
// Show original error message in dev mode, but hide with the react fallback RSC error message in production mode
expect(await browser.elementByCss('#error').text()).toBe(
......@@ -81,13 +72,7 @@ describe('app dir - global error', () => {
if (isNextDev) {
await assertHasRedbox(browser)
const description = await getRedboxDescription(browser)
if (isNewOverlay) {
expect(description).toMatchInlineSnapshot(`"Error: Metadata error"`)
} else {
expect(description).toMatchInlineSnapshot(
`"[ Server ] Error: Metadata error"`
)
}
expect(description).toMatchInlineSnapshot(`"Error: Metadata error"`)
}
expect(await browser.elementByCss('h1').text()).toBe('Global Error')
expect(await browser.elementByCss('#error').text()).toBe(
......
......@@ -17,13 +17,7 @@ describe('app dir - global error - layout error', () => {
if (isNextDev) {
await assertHasRedbox(browser)
const description = await getRedboxDescription(browser)
if (process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true') {
expect(description).toMatchInlineSnapshot(`"Error: layout error"`)
} else {
expect(description).toMatchInlineSnapshot(
`"[ Server ] Error: layout error"`
)
}
expect(description).toMatchInlineSnapshot(`"Error: layout error"`)
}
expect(await browser.elementByCss('h1').text()).toBe('Global Error')
......
......@@ -18,9 +18,6 @@ describe('use-cache-close-over-function', () => {
return
}
const isNewOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
if (isNextDev) {
it('should show an error toast for client-side usage', async () => {
const outputIndex = next.cliOutput.length
......@@ -31,19 +28,11 @@ describe('use-cache-close-over-function', () => {
const errorDescription = await getRedboxDescription(browser)
const errorSource = await getRedboxSource(browser)
if (isNewOverlay) {
expect(errorDescription).toMatchInlineSnapshot(`
expect(errorDescription).toMatchInlineSnapshot(`
"Error: Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server". Or maybe you meant to call this function rather than return it.
[function fn]
^^^^^^^^^^^"
`)
} else {
expect(errorDescription).toMatchInlineSnapshot(`
"[ Prerender ] Error: Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server". Or maybe you meant to call this function rather than return it.
[function fn]
^^^^^^^^^^^"
`)
}
expect(errorSource).toMatchInlineSnapshot(`
"app/client/page.tsx (8:3) @ createCachedFn
......@@ -97,19 +86,11 @@ describe('use-cache-close-over-function', () => {
const errorDescription = await getRedboxDescription(browser)
const errorSource = await getRedboxSource(browser)
if (isNewOverlay) {
expect(errorDescription).toMatchInlineSnapshot(`
expect(errorDescription).toMatchInlineSnapshot(`
"Error: Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server". Or maybe you meant to call this function rather than return it.
[function fn]
^^^^^^^^^^^"
`)
} else {
expect(errorDescription).toMatchInlineSnapshot(`
"[ Prerender ] Error: Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server". Or maybe you meant to call this function rather than return it.
[function fn]
^^^^^^^^^^^"
`)
}
expect(errorSource).toMatchInlineSnapshot(`
"app/server/page.tsx (6:3) @ createCachedFn
......
......@@ -11,8 +11,6 @@ import {
import stripAnsi from 'strip-ansi'
const isExperimentalReact = process.env.__NEXT_EXPERIMENTAL_PPR
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
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".'
......@@ -43,11 +41,7 @@ describe('use-cache-hanging-inputs', () => {
const errorDescription = await getRedboxDescription(browser)
const errorSource = await getRedboxSource(browser)
if (isNewDevOverlay) {
expect(errorDescription).toBe(expectedErrorMessage)
} else {
expect(errorDescription).toBe(`[ Cache ] ${expectedErrorMessage}`)
}
expect(errorDescription).toBe(expectedErrorMessage)
const cliOutput = stripAnsi(next.cliOutput.slice(outputIndex))
......@@ -106,11 +100,7 @@ describe('use-cache-hanging-inputs', () => {
const errorDescription = await getRedboxDescription(browser)
const errorSource = await getRedboxSource(browser)
if (isNewDevOverlay) {
expect(errorDescription).toBe(expectedErrorMessage)
} else {
expect(errorDescription).toBe(`[ Cache ] ${expectedErrorMessage}`)
}
expect(errorDescription).toBe(expectedErrorMessage)
const cliOutput = stripAnsi(next.cliOutput.slice(outputIndex))
......@@ -156,11 +146,7 @@ describe('use-cache-hanging-inputs', () => {
const errorDescription = await getRedboxDescription(browser)
const errorSource = await getRedboxSource(browser)
if (isNewDevOverlay) {
expect(errorDescription).toBe(expectedErrorMessage)
} else {
expect(errorDescription).toBe(`[ Cache ] ${expectedErrorMessage}`)
}
expect(errorDescription).toBe(expectedErrorMessage)
const cliOutput = stripAnsi(next.cliOutput.slice(outputIndex))
......@@ -217,24 +203,14 @@ describe('use-cache-hanging-inputs', () => {
const expectedErrorMessagePpr =
'Error: Route "/bound-args": A component accessed data, headers, params, searchParams, or a short-lived cache without a Suspense boundary nor a "use cache" above it. We don\'t have the exact line number added to error messages yet but you can see which component in the stack below. See more info: https://nextjs.org/docs/messages/next-prerender-missing-suspense'
if (isNewDevOverlay) {
expect(errorDescription).toBe(expectedErrorMessagePpr)
} else {
expect(errorDescription).toBe(
`[ Server ] ${expectedErrorMessagePpr}`
)
}
expect(errorDescription).toBe(expectedErrorMessagePpr)
expect(cliOutput).toContain(
`${expectedErrorMessagePpr}
at Page [Server] (<anonymous>)`
)
} else {
if (isNewDevOverlay) {
expect(errorDescription).toBe(expectedErrorMessage)
} else {
expect(errorDescription).toBe(`[ Cache ] ${expectedErrorMessage}`)
}
expect(errorDescription).toBe(expectedErrorMessage)
if (isTurbopack) {
// TODO(veil): For Turbopack, a fix in the React Flight Client, where
......@@ -275,19 +251,11 @@ describe('use-cache-hanging-inputs', () => {
const title = await getRedboxTitle(browser)
const description = await getRedboxDescription(browser)
if (isNewDevOverlay) {
expect({ count, title, description }).toEqual({
count: 1,
title: 'Unhandled Runtime Error\nCache',
description: 'Error: kaputt!',
})
} else {
expect({ count, title, description }).toEqual({
count: 1,
title: 'Unhandled Runtime Error',
description: '[ Cache ] Error: kaputt!',
})
}
expect({ count, title, description }).toEqual({
count: 1,
title: 'Unhandled Runtime Error\nCache',
description: 'Error: kaputt!',
})
})
})
} else {
......
......@@ -39,11 +39,7 @@ describe('use-cache-standalone-search-params', () => {
const errorSource = await getRedboxSource(browser)
const expectedErrorMessage = getExpectedErrorMessage(route)
if (process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true') {
expect(errorDescription).toBe(expectedErrorMessage)
} else {
expect(errorDescription).toBe(`[ Cache ] ${expectedErrorMessage}`)
}
expect(errorDescription).toBe(expectedErrorMessage)
const cliOutput = stripAnsi(next.cliOutput.slice(outputIndex))
......
......@@ -30,9 +30,6 @@ describe('use-cache-unknown-cache-kind', () => {
return
}
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
if (isNextStart) {
beforeAll(async () => {
await next.build()
......@@ -105,10 +102,8 @@ describe('use-cache-unknown-cache-kind', () => {
expect(errorDescription).toBe('Failed to compile')
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
if (isNewDevOverlay) {
if (isTurbopack) {
expect(errorSource).toMatchInlineSnapshot(`
if (isTurbopack) {
expect(errorSource).toMatchInlineSnapshot(`
"./app/page.tsx (1:1)
Ecmascript file had an error
> 1 | 'use cache: custom'
......@@ -119,8 +114,8 @@ describe('use-cache-unknown-cache-kind', () => {
Unknown cache kind "custom". Please configure a cache handler for this kind in the "experimental.cacheHandlers" object in your Next.js config."
`)
} else {
expect(errorSource).toMatchInlineSnapshot(`
} else {
expect(errorSource).toMatchInlineSnapshot(`
"./app/page.tsx
Error: x Unknown cache kind "custom". Please configure a cache handler for this kind in the "experimental.cacheHandlers" object in your Next.js config.
|
......@@ -132,34 +127,6 @@ describe('use-cache-unknown-cache-kind', () => {
4 | return <p>hello world</p>
\`----"
`)
}
} else {
if (isTurbopack) {
expect(errorSource).toMatchInlineSnapshot(`
"./app/page.tsx (1:1)
Ecmascript file had an error
> 1 | 'use cache: custom'
| ^^^^^^^^^^^^^^^^^^^
2 |
3 | export default async function Page() {
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."
`)
} else {
expect(errorSource).toMatchInlineSnapshot(`
"./app/page.tsx
Error: x Unknown cache kind "custom". Please configure a cache handler for this kind in the "experimental.cacheHandlers" object in your Next.js config.
|
,-[1:1]
1 | 'use cache: custom'
: ^^^^^^^^^^^^^^^^^^^
2 |
3 | export default async function Page() {
4 | return <p>hello world</p>
\`----"
`)
}
}
})
......
......@@ -24,9 +24,6 @@ describe('use-cache-without-experimental-flag', () => {
return
}
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
if (isNextStart) {
it('should fail the build with an error', async () => {
const { cliOutput } = await next.build()
......@@ -89,10 +86,8 @@ describe('use-cache-without-experimental-flag', () => {
expect(errorDescription).toBe('Failed to compile')
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
if (isNewDevOverlay) {
if (isTurbopack) {
expect(errorSource).toMatchInlineSnapshot(`
if (isTurbopack) {
expect(errorSource).toMatchInlineSnapshot(`
"./app/page.tsx (1:1)
Ecmascript file had an error
> 1 | 'use cache'
......@@ -105,39 +100,8 @@ describe('use-cache-without-experimental-flag', () => {
Read more: https://nextjs.org/docs/canary/app/api-reference/directives/use-cache#usage"
`)
} else {
expect(errorSource).toMatchInlineSnapshot(`
"./app/page.tsx
Error: x To use "use cache", please enable the experimental feature flag "useCache" in your Next.js config.
|
| Read more: https://nextjs.org/docs/canary/app/api-reference/directives/use-cache#usage
|
,-[1:1]
1 | 'use cache'
: ^^^^^^^^^^^
2 |
3 | export default async function Page() {
4 | return <p>hello world</p>
\`----"
`)
}
} else {
if (isTurbopack) {
expect(errorSource).toMatchInlineSnapshot(`
"./app/page.tsx (1:1)
Ecmascript file had an error
> 1 | 'use cache'
| ^^^^^^^^^^^
2 |
3 | export default async function Page() {
4 | return <p>hello world</p>
To use "use cache", please enable the experimental feature flag "useCache" in your Next.js config.
Read more: https://nextjs.org/docs/canary/app/api-reference/directives/use-cache#usage"
`)
} else {
expect(errorSource).toMatchInlineSnapshot(`
expect(errorSource).toMatchInlineSnapshot(`
"./app/page.tsx
Error: x To use "use cache", please enable the experimental feature flag "useCache" in your Next.js config.
|
......@@ -151,7 +115,6 @@ describe('use-cache-without-experimental-flag', () => {
4 | return <p>hello world</p>
\`----"
`)
}
}
})
......
......@@ -11,13 +11,8 @@ const nextConfig = join(appDir, 'next.config.js')
let appPort
let app
// TODO(new-dev-overlay): Remove this once old dev overlay fork is removed
const isNewDevOverlay =
process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'true'
const installCheckVisible = (browser) => {
if (isNewDevOverlay) {
return browser.eval(`(function() {
return browser.eval(`(function() {
window.checkInterval = setInterval(function() {
const root = document.querySelector('nextjs-portal').shadowRoot;
const indicator = root.querySelector('[data-next-mark]')
......@@ -27,18 +22,6 @@ const installCheckVisible = (browser) => {
if (window.showedBuilder) clearInterval(window.checkInterval)
}, 5)
})()`)
} else {
return browser.eval(`(function() {
window.checkInterval = setInterval(function() {
let watcherDiv = document.querySelector('#__next-build-indicator')
watcherDiv = watcherDiv.shadowRoot || watcherDiv
window.showedBuilder = window.showedBuilder || (
watcherDiv.querySelector('div').className.indexOf('visible') > -1
)
if (window.showedBuilder) clearInterval(window.checkInterval)
}, 5)
})()`)
}
}
describe('Build Activity Indicator', () => {
......@@ -83,21 +66,6 @@ describe('Build Activity Indicator', () => {
app = await launchApp(appDir, appPort)
})
afterAll(() => killApp(app))
// The indicator has no special container in the new dev overlay -
// it's rendered as part of the indicator logo
if (!isNewDevOverlay) {
it('Adds the build indicator container', async () => {
const browser = await webdriver(
appPort,
pagesOrApp === 'pages' ? '/' : '/app'
)
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', () => {
it('Shows the build indicator when a page is built during navigation', async () => {
const browser = await webdriver(
......@@ -135,34 +103,4 @@ describe('Build Activity Indicator', () => {
await browser.close()
})
})
describe.each(['pages', 'app'])(
'Disabled with next.config.js - (%s)',
(pagesOrApp) => {
beforeAll(async () => {
await fs.writeFile(
nextConfig,
'module.exports = { devIndicators: { buildActivity: false } }',
'utf8'
)
appPort = await findPort()
app = await launchApp(appDir, appPort)
})
afterAll(async () => {
await killApp(app)
await fs.remove(nextConfig)
})
it('Does not add the build indicator container', async () => {
const browser = await webdriver(
appPort,
pagesOrApp === 'pages' ? '/' : '/app'
)
const html = await browser.eval('document.body.innerHTML')
expect(html).not.toMatch(/__next-build-indicator/)
await browser.close()
})
}
)
})
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