Unverified Commit e0966df1 authored by Josh Story's avatar Josh Story Committed by GitHub

test: migrate caching deploy exclusions to force gates (#98154)

## Summary

- migrate Cache Components, PPR, prefetching, prerendering,
revalidation, and SSG deployment exclusions to `@force-gate`
- remove the corresponding `skipDeployment` options and `skipped`
control flow while preserving each suite's rationale

This keeps caching-related exclusions together so their deployed
semantics can be reviewed by the same owners.

## Verification

- verified on the combined top-of-stack tree with `pnpm typescript`
- compared ordinary-mode collection before and after: all 4,670 existing
test names matched
- collected all 510 affected files in deploy mode: 4,578 skipped tests,
zero failures

<!-- NEXT_JS_LLM -->
parent 6caa7860
import { nextTestSetup, isNextStart } from 'e2e-utils' import { nextTestSetup, isNextStart } from 'e2e-utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// Assertions don't apply to deploy mode (output differs vs. local Next.js server).
// @force-gate !deploy
describe('404 Page Support SSG', () => { describe('404 Page Support SSG', () => {
const { next, skipped } = nextTestSetup({ const { next } = nextTestSetup({
files: __dirname, files: __dirname,
disableAutoSkewProtection: true, disableAutoSkewProtection: true,
// Assertions don't apply to deploy mode (output differs vs. local Next.js server).
skipDeployment: true,
}) })
if (skipped) return
it('should respond to 404 correctly', async () => { it('should respond to 404 correctly', async () => {
const res = await next.fetch('/404') const res = await next.fetch('/404')
......
...@@ -234,6 +234,8 @@ describe('app dir client cache semantics (experimental staleTimes)', () => { ...@@ -234,6 +234,8 @@ describe('app dir client cache semantics (experimental staleTimes)', () => {
}) })
}) })
// Deploy mode exclusion: This nested suite reads telemetry events from the
// local Next.js CLI output.
if (!isNextDeploy) { if (!isNextDeploy) {
describe('telemetry', () => { describe('telemetry', () => {
it('should send staleTimes feature usage event', async () => { it('should send staleTimes feature usage event', async () => {
...@@ -368,6 +370,8 @@ describe('app dir client cache semantics (experimental staleTimes)', () => { ...@@ -368,6 +370,8 @@ describe('app dir client cache semantics (experimental staleTimes)', () => {
}) })
}) })
// Deploy mode exclusion: This nested suite reads telemetry events from the
// local Next.js CLI output.
if (!isNextDeploy) { if (!isNextDeploy) {
describe('telemetry', () => { describe('telemetry', () => {
it('should send staleTimes feature usage event', async () => { it('should send staleTimes feature usage event', async () => {
......
...@@ -9,16 +9,16 @@ import { ...@@ -9,16 +9,16 @@ import {
import path from 'path' import path from 'path'
// This preserves existing tests for the 30s/5min heuristic (previous router defaults) // This preserves existing tests for the 30s/5min heuristic (previous router defaults)
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// Assertions don't apply to deploy mode (output differs vs. local Next.js server).
// @force-gate !deploy
describe('app dir client cache semantics (30s/5min)', () => { describe('app dir client cache semantics (30s/5min)', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: path.join(__dirname, 'fixtures', 'regular'), files: path.join(__dirname, 'fixtures', 'regular'),
nextConfig: { nextConfig: {
experimental: { staleTimes: { dynamic: 30, static: 180 } }, experimental: { staleTimes: { dynamic: 30, static: 180 } },
}, },
// Assertions don't apply to deploy mode (output differs vs. local Next.js server).
skipDeployment: true,
}) })
if (skipped) return
if (isNextDev) { if (isNextDev) {
// dev doesn't support prefetch={true}, so this just performs a basic test to make sure data is reused for 30s // dev doesn't support prefetch={true}, so this just performs a basic test to make sure data is reused for 30s
......
...@@ -2,17 +2,15 @@ import { nextTestSetup } from 'e2e-utils' ...@@ -2,17 +2,15 @@ import { nextTestSetup } from 'e2e-utils'
import { hasErrorToast, retry, waitFor, waitForNoRedbox } from 'next-test-utils' import { hasErrorToast, retry, waitFor, waitForNoRedbox } from 'next-test-utils'
import stripAnsi from 'strip-ansi' import stripAnsi from 'strip-ansi'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('app-custom-cache-handler-errors - get throws', () => { describe('app-custom-cache-handler-errors - get throws', () => {
const { next, isNextDev, isTurbopack, skipped } = nextTestSetup({ const { next, isNextDev, isTurbopack } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
env: { CACHE_HANDLER_THROW_ON: 'get' }, env: { CACHE_HANDLER_THROW_ON: 'get' },
}) })
if (skipped) {
return
}
it('surfaces the cache handler error', async () => { it('surfaces the cache handler error', async () => {
const outputIndex = next.cliOutput.length const outputIndex = next.cliOutput.length
const browser = await next.browser('/?input=x') const browser = await next.browser('/?input=x')
...@@ -96,17 +94,15 @@ describe('app-custom-cache-handler-errors - get throws', () => { ...@@ -96,17 +94,15 @@ describe('app-custom-cache-handler-errors - get throws', () => {
}) })
}) })
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('app-custom-cache-handler-errors - set throws', () => { describe('app-custom-cache-handler-errors - set throws', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
env: { CACHE_HANDLER_THROW_ON: 'set' }, env: { CACHE_HANDLER_THROW_ON: 'set' },
}) })
if (skipped) {
return
}
it('renders the page successfully', async () => { it('renders the page successfully', async () => {
const outputIndex = next.cliOutput.length const outputIndex = next.cliOutput.length
const browser = await next.browser('/?input=x') const browser = await next.browser('/?input=x')
......
...@@ -30,40 +30,39 @@ function runTests( ...@@ -30,40 +30,39 @@ function runTests(
}) })
} }
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('app-dir - custom-cache-handler - cjs', () => { describe('app-dir - custom-cache-handler - cjs', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
env: { env: {
CUSTOM_CACHE_HANDLER: 'cache-handler.js', CUSTOM_CACHE_HANDLER: 'cache-handler.js',
}, },
}) })
if (skipped) {
return
}
runTests('cjs module exports', { next, isNextDev }) runTests('cjs module exports', { next, isNextDev })
}) })
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('app-dir - custom-cache-handler - cjs-default-export', () => { describe('app-dir - custom-cache-handler - cjs-default-export', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
env: { env: {
CUSTOM_CACHE_HANDLER: 'cache-handler-cjs-default-export.js', CUSTOM_CACHE_HANDLER: 'cache-handler-cjs-default-export.js',
}, },
}) })
if (skipped) {
return
}
runTests('cjs default export', { next, isNextDev }) runTests('cjs default export', { next, isNextDev })
}) })
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('app-dir - custom-cache-handler - esm', () => { describe('app-dir - custom-cache-handler - esm', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: { files: {
app: new FileRef(__dirname + '/app'), app: new FileRef(__dirname + '/app'),
'cache-handler-esm.js': new FileRef(__dirname + '/cache-handler-esm.js'), 'cache-handler-esm.js': new FileRef(__dirname + '/cache-handler-esm.js'),
...@@ -72,7 +71,6 @@ describe('app-dir - custom-cache-handler - esm', () => { ...@@ -72,7 +71,6 @@ describe('app-dir - custom-cache-handler - esm', () => {
'export default ' 'export default '
), ),
}, },
skipDeployment: true,
packageJson: { packageJson: {
type: 'module', type: 'module',
}, },
...@@ -81,29 +79,23 @@ describe('app-dir - custom-cache-handler - esm', () => { ...@@ -81,29 +79,23 @@ describe('app-dir - custom-cache-handler - esm', () => {
}, },
}) })
if (skipped) {
return
}
runTests('esm default export', { next, isNextDev }) runTests('esm default export', { next, isNextDev })
}) })
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('app-dir - custom-cache-handler - esm import.meta.resolve', () => { describe('app-dir - custom-cache-handler - esm import.meta.resolve', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: { files: {
app: new FileRef(__dirname + '/app'), app: new FileRef(__dirname + '/app'),
'cache-handler-esm.js': new FileRef(__dirname + '/cache-handler-esm.js'), 'cache-handler-esm.js': new FileRef(__dirname + '/cache-handler-esm.js'),
'next.config.js': importMetaResolveNextConfig, 'next.config.js': importMetaResolveNextConfig,
}, },
skipDeployment: true,
packageJson: { packageJson: {
type: 'module', type: 'module',
}, },
}) })
if (skipped) {
return
}
runTests('esm default export', { next, isNextDev }) runTests('esm default export', { next, isNextDev })
}) })
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
import { check } from 'next-test-utils' import { check } from 'next-test-utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('app-invalid-revalidate', () => { describe('app-invalid-revalidate', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname, files: __dirname,
skipStart: true, skipStart: true,
skipDeployment: true,
}) })
if (skipped) {
return
}
it('should error properly for invalid revalidate at layout', async () => { it('should error properly for invalid revalidate at layout', async () => {
await next.stop().catch(() => {}) await next.stop().catch(() => {})
const origText = await next.readFile('app/layout.tsx') const origText = await next.readFile('app/layout.tsx')
......
...@@ -3,12 +3,14 @@ import { createRouterAct } from 'router-act' ...@@ -3,12 +3,14 @@ import { createRouterAct } from 'router-act'
import { createTimeController } from './test-utils' import { createTimeController } from './test-utils'
import { join } from 'path' import { join } from 'path'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// No deploy-specific incompatibility is documented.
// @force-gate !deploy
describe('app dir - prefetching (custom staleTime)', () => { describe('app dir - prefetching (custom staleTime)', () => {
const { next, isNextDev } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: { files: {
app: new FileRef(join(__dirname, 'app')), app: new FileRef(join(__dirname, 'app')),
}, },
skipDeployment: true,
nextConfig: { nextConfig: {
experimental: { experimental: {
staleTimes: { staleTimes: {
......
...@@ -393,7 +393,8 @@ describe('app dir - prefetching', () => { ...@@ -393,7 +393,8 @@ describe('app dir - prefetching', () => {
}) })
}) })
// These tests are skipped when deployed as they rely on runtime logs // Deploy mode exclusion: This nested suite asserts runtime logs from the
// local Next.js process.
if (!isNextDeploy) { if (!isNextDeploy) {
describe('dynamic rendering', () => { describe('dynamic rendering', () => {
describe.each(['/force-dynamic', '/revalidate-0'])('%s', (basePath) => { describe.each(['/force-dynamic', '/revalidate-0'])('%s', (basePath) => {
......
...@@ -291,15 +291,14 @@ describe('app-root-param-getters - cache - at build', () => { ...@@ -291,15 +291,14 @@ describe('app-root-param-getters - cache - at build', () => {
} }
}) })
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// In deploy mode, concurrent requests could hit different lambdas.
// @force-gate !deploy
describe('app-root-param-getters - cache dedup with root params', () => { describe('app-root-param-getters - cache dedup with root params', () => {
const { next, skipped, isNextDev } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: join(__dirname, 'fixtures', 'use-cache-dedup'), files: join(__dirname, 'fixtures', 'use-cache-dedup'),
// In deploy mode, concurrent requests could hit different lambdas.
skipDeployment: true,
}) })
if (skipped) return
it('should dedupe same root params and isolate different root params', async () => { it('should dedupe same root params and isolate different root params', async () => {
// Three concurrent requests: ca/en, ca/fr, ca/fr. // Three concurrent requests: ca/en, ca/fr, ca/fr.
const [$en, $fr1, $fr2] = await Promise.all([ const [$en, $fr1, $fr2] = await Promise.all([
......
...@@ -3,20 +3,19 @@ import { retry } from 'next-test-utils' ...@@ -3,20 +3,19 @@ import { retry } from 'next-test-utils'
import stripAnsi from 'strip-ansi' import stripAnsi from 'strip-ansi'
// TODO(restart-on-cache-miss): cacheSignal timing changes break console log dimming/hiding tests // TODO(restart-on-cache-miss): cacheSignal timing changes break console log dimming/hiding tests
describe.skip('cache-components - Console Dimming - Validation', () => { // TODO(deploy-test-completion): Re-enable this suite in deploy mode.
const { next, skipped, isTurbopack } = nextTestSetup({ // It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
// @force-gate TODO
describe('cache-components - Console Dimming - Validation', () => {
const { next, isTurbopack } = nextTestSetup({
env: { env: {
FORCE_COLOR: '1', FORCE_COLOR: '1',
}, },
files: __dirname + '/fixtures/default', files: __dirname + '/fixtures/default',
skipDeployment: true,
skipStart: !isNextDev, skipStart: !isNextDev,
}) })
if (skipped) {
return
}
it('dims console calls during prospective rendering', async () => { it('dims console calls during prospective rendering', async () => {
const path: string = '/console' const path: string = '/console'
if (isNextDev) { if (isNextDev) {
...@@ -202,20 +201,18 @@ describe.skip('cache-components - Console Dimming - Validation', () => { ...@@ -202,20 +201,18 @@ describe.skip('cache-components - Console Dimming - Validation', () => {
// TODO(restart-on-cache-miss): cacheSignal timing changes break console log dimming/hiding tests // TODO(restart-on-cache-miss): cacheSignal timing changes break console log dimming/hiding tests
describe.skip('cache-components - Logging after Abort', () => { describe.skip('cache-components - Logging after Abort', () => {
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('(default) With Dimming - Server', () => { describe('(default) With Dimming - Server', () => {
const { next, skipped, isTurbopack } = nextTestSetup({ const { next, isTurbopack } = nextTestSetup({
env: { env: {
FORCE_COLOR: '1', FORCE_COLOR: '1',
}, },
files: __dirname + '/fixtures/default', files: __dirname + '/fixtures/default',
skipDeployment: true,
skipStart: !isNextDev, skipStart: !isNextDev,
}) })
if (skipped) {
return
}
it('dims console calls after a prerender has aborted', async () => { it('dims console calls after a prerender has aborted', async () => {
const path: string = '/console-after-abort/server' const path: string = '/console-after-abort/server'
...@@ -380,20 +377,18 @@ describe.skip('cache-components - Logging after Abort', () => { ...@@ -380,20 +377,18 @@ describe.skip('cache-components - Logging after Abort', () => {
}) })
}) })
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('(default) With Dimming - Client', () => { describe('(default) With Dimming - Client', () => {
const { next, skipped, isTurbopack } = nextTestSetup({ const { next, isTurbopack } = nextTestSetup({
env: { env: {
FORCE_COLOR: '1', FORCE_COLOR: '1',
}, },
files: __dirname + '/fixtures/default', files: __dirname + '/fixtures/default',
skipDeployment: true,
skipStart: !isNextDev, skipStart: !isNextDev,
}) })
if (skipped) {
return
}
it('dims console calls after a prerender has aborted', async () => { it('dims console calls after a prerender has aborted', async () => {
const path: string = '/console-after-abort/client' const path: string = '/console-after-abort/client'
...@@ -549,20 +544,18 @@ describe.skip('cache-components - Logging after Abort', () => { ...@@ -549,20 +544,18 @@ describe.skip('cache-components - Logging after Abort', () => {
}) })
}) })
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('With Hiding - Server', () => { describe('With Hiding - Server', () => {
const { next, skipped } = nextTestSetup({ const { next } = nextTestSetup({
env: { env: {
FORCE_COLOR: '1', FORCE_COLOR: '1',
}, },
files: __dirname + '/fixtures/hide-logs-after-abort', files: __dirname + '/fixtures/hide-logs-after-abort',
skipDeployment: true,
skipStart: !isNextDev, skipStart: !isNextDev,
}) })
if (skipped) {
return
}
it('hides console calls after a prerender has aborted', async () => { it('hides console calls after a prerender has aborted', async () => {
const path: string = '/console-after-abort/server' const path: string = '/console-after-abort/server'
...@@ -650,20 +643,18 @@ describe.skip('cache-components - Logging after Abort', () => { ...@@ -650,20 +643,18 @@ describe.skip('cache-components - Logging after Abort', () => {
}) })
}) })
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('With Hiding - Client', () => { describe('With Hiding - Client', () => {
const { next, skipped } = nextTestSetup({ const { next } = nextTestSetup({
env: { env: {
FORCE_COLOR: '1', FORCE_COLOR: '1',
}, },
files: __dirname + '/fixtures/hide-logs-after-abort', files: __dirname + '/fixtures/hide-logs-after-abort',
skipDeployment: true,
skipStart: !isNextDev, skipStart: !isNextDev,
}) })
if (skipped) {
return
}
it('hides console calls after a prerender has aborted', async () => { it('hides console calls after a prerender has aborted', async () => {
const path: string = '/console-after-abort/client' const path: string = '/console-after-abort/client'
......
import { isNextDev, nextTestSetup } from 'e2e-utils' import { isNextDev, nextTestSetup } from 'e2e-utils'
import { waitForNoRedbox } from 'next-test-utils' import { waitForNoRedbox } from 'next-test-utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('hello-world', () => { describe('hello-world', () => {
const { next } = nextTestSetup({ const { next } = nextTestSetup({
files: __dirname, files: __dirname,
skipStart: !isNextDev, skipStart: !isNextDev,
skipDeployment: true,
}) })
if (isNextDev) { if (isNextDev) {
......
...@@ -158,13 +158,13 @@ describe('async imports in cacheComponents', () => { ...@@ -158,13 +158,13 @@ describe('async imports in cacheComponents', () => {
}) })
}) })
// This block intentionally exercises a failed build, so there is no deployment to test.
// @force-gate !deploy
describe('async imports in cacheComponents - external packages', () => { describe('async imports in cacheComponents - external packages', () => {
const { next, isNextStart, skipped } = nextTestSetup({ const { next, isNextStart } = nextTestSetup({
files: path.join(__dirname, 'external'), files: path.join(__dirname, 'external'),
skipDeployment: true,
skipStart: true, skipStart: true,
}) })
if (skipped) return
// This is currently expected to fail because we can only track `import()` in bundled code, // This is currently expected to fail because we can only track `import()` in bundled code,
// and packages marked as external aren't bundled. // and packages marked as external aren't bundled.
......
import { isNextDev, nextTestSetup } from 'e2e-utils' import { isNextDev, nextTestSetup } from 'e2e-utils'
import { getPrerenderOutput } from './utils' import { getPrerenderOutput } from './utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('Cache Components Errors - Client Hook Abort Reasons', () => { describe('Cache Components Errors - Client Hook Abort Reasons', () => {
const { next, isTurbopack, isNextStart, skipped } = nextTestSetup({ const { next, isTurbopack, isNextStart } = nextTestSetup({
files: __dirname + '/fixtures/client-hook-abort-reasons', files: __dirname + '/fixtures/client-hook-abort-reasons',
skipStart: !isNextDev, skipStart: !isNextDev,
skipDeployment: true,
}) })
if (skipped) {
return
}
let cliOutputLength: number let cliOutputLength: number
beforeEach(async () => { beforeEach(async () => {
......
import { isNextDev, nextTestSetup } from 'e2e-utils' import { isNextDev, nextTestSetup } from 'e2e-utils'
import { getPrerenderOutput } from './utils' import { getPrerenderOutput } from './utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('Cache Components Errors - Client Components', () => { describe('Cache Components Errors - Client Components', () => {
const { next, isTurbopack, isNextStart, skipped } = nextTestSetup({ const { next, isTurbopack, isNextStart } = nextTestSetup({
files: __dirname + '/fixtures/client', files: __dirname + '/fixtures/client',
skipStart: !isNextDev, skipStart: !isNextDev,
skipDeployment: true,
}) })
if (skipped) {
return
}
let cliOutputLength: number let cliOutputLength: number
beforeEach(async () => { beforeEach(async () => {
......
...@@ -2,20 +2,18 @@ import { isNextDev, nextTestSetup } from 'e2e-utils' ...@@ -2,20 +2,18 @@ import { isNextDev, nextTestSetup } from 'e2e-utils'
import { getPrerenderOutput } from './utils' import { getPrerenderOutput } from './utils'
import { retry } from 'next-test-utils' import { retry } from 'next-test-utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('Cache Components Errors', () => { describe('Cache Components Errors', () => {
const { next, isTurbopack, isNextStart, skipped } = nextTestSetup({ const { next, isTurbopack, isNextStart } = nextTestSetup({
files: __dirname + '/fixtures/console-patch', files: __dirname + '/fixtures/console-patch',
skipDeployment: true,
skipStart: !isNextDev, skipStart: !isNextDev,
env: { env: {
NODE_OPTIONS: '--require ./patch-console.js', NODE_OPTIONS: '--require ./patch-console.js',
}, },
}) })
if (skipped) {
return
}
let cliOutputLength: number let cliOutputLength: number
beforeEach(async () => { beforeEach(async () => {
......
import { isNextDev, nextTestSetup } from 'e2e-utils' import { isNextDev, nextTestSetup } from 'e2e-utils'
describe('Cache Components Errors', () => { describe('Cache Components Errors', () => {
const { next, skipped } = nextTestSetup({ const { next } = nextTestSetup({
files: __dirname + '/fixtures/dev-cache-bypass', files: __dirname + '/fixtures/dev-cache-bypass',
}) })
if (skipped) {
return
}
describe('Warning for Bypassing Caches in Dev', () => { describe('Warning for Bypassing Caches in Dev', () => {
async function enableDraftMode() { async function enableDraftMode() {
const draftRes = await next.fetch('/api/draft/enable', { const draftRes = await next.fetch('/api/draft/enable', {
......
...@@ -10,7 +10,7 @@ import type { CacheComponentsErrorsContext } from './shared.util' ...@@ -10,7 +10,7 @@ import type { CacheComponentsErrorsContext } from './shared.util'
export function registerErrorAttributionTests( export function registerErrorAttributionTests(
ctx: CacheComponentsErrorsContext ctx: CacheComponentsErrorsContext
) { ) {
const { next, isTurbopack, isDebugPrerender, prerender, skipped } = ctx const { next, isTurbopack, isDebugPrerender, prerender } = ctx
let cliOutputLength: number let cliOutputLength: number
beforeEach(() => { beforeEach(() => {
...@@ -21,10 +21,6 @@ export function registerErrorAttributionTests( ...@@ -21,10 +21,6 @@ export function registerErrorAttributionTests(
describe('Guarded RSC with guarded Client sync IO', () => { describe('Guarded RSC with guarded Client sync IO', () => {
const pathname = '/sync-attribution/guarded-async-guarded-clientsync' const pathname = '/sync-attribution/guarded-async-guarded-clientsync'
if (skipped) {
return
}
if (isNextDev) { if (isNextDev) {
it('does not show a validation error in the dev overlay', async () => { it('does not show a validation error in the dev overlay', async () => {
const browser = await next.browser(pathname) const browser = await next.browser(pathname)
...@@ -46,10 +42,6 @@ export function registerErrorAttributionTests( ...@@ -46,10 +42,6 @@ export function registerErrorAttributionTests(
describe('Guarded RSC with unguarded Client sync IO', () => { describe('Guarded RSC with unguarded Client sync IO', () => {
const pathname = '/sync-attribution/guarded-async-unguarded-clientsync' const pathname = '/sync-attribution/guarded-async-unguarded-clientsync'
if (skipped) {
return
}
if (isNextDev) { if (isNextDev) {
it('should show a collapsed redbox error', async () => { it('should show a collapsed redbox error', async () => {
const browser = await next.browser(pathname) const browser = await next.browser(pathname)
...@@ -193,10 +185,6 @@ export function registerErrorAttributionTests( ...@@ -193,10 +185,6 @@ export function registerErrorAttributionTests(
describe('Unguarded RSC with guarded Client sync IO', () => { describe('Unguarded RSC with guarded Client sync IO', () => {
const pathname = '/sync-attribution/unguarded-async-guarded-clientsync' const pathname = '/sync-attribution/unguarded-async-guarded-clientsync'
if (skipped) {
return
}
if (isNextDev) { if (isNextDev) {
it('should show a collapsed redbox error', async () => { it('should show a collapsed redbox error', async () => {
const browser = await next.browser(pathname) const browser = await next.browser(pathname)
...@@ -327,10 +315,6 @@ export function registerErrorAttributionTests( ...@@ -327,10 +315,6 @@ export function registerErrorAttributionTests(
const pathname = const pathname =
'/sync-attribution/unguarded-async-client-microtask-syncio' '/sync-attribution/unguarded-async-client-microtask-syncio'
if (skipped) {
return
}
if (isNextDev) { if (isNextDev) {
it('should show request data rather than attribute a microtask sync IO access', async () => { it('should show request data rather than attribute a microtask sync IO access', async () => {
const browser = await next.browser(pathname) const browser = await next.browser(pathname)
...@@ -369,10 +353,6 @@ export function registerErrorAttributionTests( ...@@ -369,10 +353,6 @@ export function registerErrorAttributionTests(
describe('unguarded RSC with unguarded Client sync IO', () => { describe('unguarded RSC with unguarded Client sync IO', () => {
const pathname = '/sync-attribution/unguarded-async-unguarded-clientsync' const pathname = '/sync-attribution/unguarded-async-unguarded-clientsync'
if (skipped) {
return
}
if (isNextDev) { if (isNextDev) {
it('should show a collapsed redbox error', async () => { it('should show a collapsed redbox error', async () => {
const browser = await next.browser(pathname) const browser = await next.browser(pathname)
......
...@@ -2,17 +2,15 @@ import { isNextDev, nextTestSetup } from 'e2e-utils' ...@@ -2,17 +2,15 @@ import { isNextDev, nextTestSetup } from 'e2e-utils'
import { retry } from 'next-test-utils' import { retry } from 'next-test-utils'
import { getPrerenderOutput } from './utils' import { getPrerenderOutput } from './utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('Cache Components HTTP Access Fallback Prerender', () => { describe('Cache Components HTTP Access Fallback Prerender', () => {
const { next, isNextStart, skipped } = nextTestSetup({ const { next, isNextStart } = nextTestSetup({
files: __dirname + '/fixtures/http-access-fallback-prerender', files: __dirname + '/fixtures/http-access-fallback-prerender',
skipStart: !isNextDev, skipStart: !isNextDev,
skipDeployment: true,
}) })
if (skipped) {
return
}
let cliOutputLength: number let cliOutputLength: number
beforeEach(() => { beforeEach(() => {
......
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('Lazy Module Init', () => { describe('Lazy Module Init', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname + '/fixtures/lazy-module-init', files: __dirname + '/fixtures/lazy-module-init',
skipStart: true, skipStart: true,
skipDeployment: true,
}) })
if (skipped) {
return
}
if (isNextDev) { if (isNextDev) {
it('does not run in dev', () => {}) it('does not run in dev', () => {})
return return
......
...@@ -2,18 +2,15 @@ import { nextTestSetup } from 'e2e-utils' ...@@ -2,18 +2,15 @@ import { nextTestSetup } from 'e2e-utils'
const isTurbopack = !!process.env.IS_TURBOPACK_TEST const isTurbopack = !!process.env.IS_TURBOPACK_TEST
// Deploy mode exclusion: This suite asserts local CLI or runtime logs that deployments do not expose.
// Accessing cliOutput is only available on the deployment
// @force-gate !deploy
describe(`Cache Components Prospective Render Errors - Debug Build`, () => { describe(`Cache Components Prospective Render Errors - Debug Build`, () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname + '/fixtures/prospective-render-errors', files: __dirname + '/fixtures/prospective-render-errors',
env: { NEXT_DEBUG_BUILD: 'true' }, env: { NEXT_DEBUG_BUILD: 'true' },
// Accessing cliOutput is only available on the deployment
skipDeployment: true,
}) })
if (skipped) {
return
}
if (isNextDev) { if (isNextDev) {
// In next dev there really isn't a prospective render but we still assert we error on the first visit to each page // In next dev there really isn't a prospective render but we still assert we error on the first visit to each page
it('should error on the first visit to each page', async () => { it('should error on the first visit to each page', async () => {
...@@ -146,14 +143,10 @@ describe(`Cache Components Prospective Render Errors - Debug Build`, () => { ...@@ -146,14 +143,10 @@ describe(`Cache Components Prospective Render Errors - Debug Build`, () => {
}) })
describe(`Cache Components Prospective Render Errors - Standard Build`, () => { describe(`Cache Components Prospective Render Errors - Standard Build`, () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname + '/fixtures/prospective-render-errors', files: __dirname + '/fixtures/prospective-render-errors',
}) })
if (skipped) {
return
}
if (isNextDev) { if (isNextDev) {
// In next dev there really isn't a prospective render but we still assert we error on the first visit to each page // In next dev there really isn't a prospective render but we still assert we error on the first visit to each page
it('should error on the first visit to each page', async () => { it('should error on the first visit to each page', async () => {
......
...@@ -8,9 +8,6 @@ export interface CacheComponentsErrorsContext { ...@@ -8,9 +8,6 @@ export interface CacheComponentsErrorsContext {
isNextStart: boolean isNextStart: boolean
isDebugPrerender: boolean isDebugPrerender: boolean
prerender: (pathname: string) => Promise<void> prerender: (pathname: string) => Promise<void>
// Always false when sections run (the wrapper returns early when skipped);
// exposed because some sections carry redundant guards.
skipped: boolean
} }
// This suite is far too slow to run as a single CI test file, so it's split // This suite is far too slow to run as a single CI test file, so it's split
...@@ -21,18 +18,14 @@ export interface CacheComponentsErrorsContext { ...@@ -21,18 +18,14 @@ export interface CacheComponentsErrorsContext {
export function runCacheComponentsErrorsTests( export function runCacheComponentsErrorsTests(
registerTests: (ctx: CacheComponentsErrorsContext) => void registerTests: (ctx: CacheComponentsErrorsContext) => void
) { ) {
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// No deploy-specific incompatibility is documented.
// @force-gate !deploy
describe('Cache Components Errors', () => { describe('Cache Components Errors', () => {
const { next, isTurbopack, isNextStart, skipped, isRspack } = nextTestSetup( const { next, isTurbopack, isNextStart, isRspack } = nextTestSetup({
{ files: __dirname + '/fixtures/default',
files: __dirname + '/fixtures/default', skipStart: !isNextDev,
skipStart: !isNextDev, })
skipDeployment: true,
}
)
if (skipped) {
return
}
afterEach(async () => { afterEach(async () => {
if (isNextStart) { if (isNextStart) {
...@@ -99,7 +92,6 @@ export function runCacheComponentsErrorsTests( ...@@ -99,7 +92,6 @@ export function runCacheComponentsErrorsTests(
isNextStart, isNextStart,
isDebugPrerender, isDebugPrerender,
prerender, prerender,
skipped,
}) })
}) })
}) })
......
...@@ -3,8 +3,7 @@ import { getPrerenderOutput } from './utils' ...@@ -3,8 +3,7 @@ import { getPrerenderOutput } from './utils'
import type { CacheComponentsErrorsContext } from './shared.util' import type { CacheComponentsErrorsContext } from './shared.util'
export function registerSyncDynamicTests(ctx: CacheComponentsErrorsContext) { export function registerSyncDynamicTests(ctx: CacheComponentsErrorsContext) {
const { next, isTurbopack, isRspack, isDebugPrerender, prerender, skipped } = const { next, isTurbopack, isRspack, isDebugPrerender, prerender } = ctx
ctx
let cliOutputLength: number let cliOutputLength: number
beforeEach(() => { beforeEach(() => {
...@@ -15,10 +14,6 @@ export function registerSyncDynamicTests(ctx: CacheComponentsErrorsContext) { ...@@ -15,10 +14,6 @@ export function registerSyncDynamicTests(ctx: CacheComponentsErrorsContext) {
describe('With Fallback - Math.random()', () => { describe('With Fallback - Math.random()', () => {
const pathname = '/sync-random-with-fallback' const pathname = '/sync-random-with-fallback'
if (skipped) {
return
}
if (isNextDev) { if (isNextDev) {
it('should show a collapsed redbox error', async () => { it('should show a collapsed redbox error', async () => {
const browser = await next.browser(pathname) const browser = await next.browser(pathname)
...@@ -162,10 +157,6 @@ export function registerSyncDynamicTests(ctx: CacheComponentsErrorsContext) { ...@@ -162,10 +157,6 @@ export function registerSyncDynamicTests(ctx: CacheComponentsErrorsContext) {
describe('Without Fallback - Math.random()', () => { describe('Without Fallback - Math.random()', () => {
const pathname = '/sync-random-without-fallback' const pathname = '/sync-random-without-fallback'
if (skipped) {
return
}
if (isNextDev) { if (isNextDev) {
it('should show a collapsed redbox error', async () => { it('should show a collapsed redbox error', async () => {
const browser = await next.browser(pathname) const browser = await next.browser(pathname)
...@@ -314,10 +305,6 @@ export function registerSyncDynamicTests(ctx: CacheComponentsErrorsContext) { ...@@ -314,10 +305,6 @@ export function registerSyncDynamicTests(ctx: CacheComponentsErrorsContext) {
describe('client searchParams', () => { describe('client searchParams', () => {
const pathname = '/sync-client-search' const pathname = '/sync-client-search'
if (skipped) {
return
}
if (isNextDev) { if (isNextDev) {
it('should return `undefined` for `searchParams.foo`', async () => { it('should return `undefined` for `searchParams.foo`', async () => {
const browser = await next.browser(`${pathname}?foo=test`) const browser = await next.browser(`${pathname}?foo=test`)
...@@ -351,10 +338,6 @@ export function registerSyncDynamicTests(ctx: CacheComponentsErrorsContext) { ...@@ -351,10 +338,6 @@ export function registerSyncDynamicTests(ctx: CacheComponentsErrorsContext) {
describe('server searchParams', () => { describe('server searchParams', () => {
const pathname = '/sync-server-search' const pathname = '/sync-server-search'
if (skipped) {
return
}
if (isNextDev) { if (isNextDev) {
it('should return `undefined` for `searchParams.foo`', async () => { it('should return `undefined` for `searchParams.foo`', async () => {
const browser = await next.browser(`${pathname}?foo=test`) const browser = await next.browser(`${pathname}?foo=test`)
...@@ -388,10 +371,6 @@ export function registerSyncDynamicTests(ctx: CacheComponentsErrorsContext) { ...@@ -388,10 +371,6 @@ export function registerSyncDynamicTests(ctx: CacheComponentsErrorsContext) {
describe('cookies', () => { describe('cookies', () => {
const pathname = '/sync-cookies' const pathname = '/sync-cookies'
if (skipped) {
return
}
if (isNextDev) { if (isNextDev) {
it('should show a redbox with a sync access error and a runtime error', async () => { it('should show a redbox with a sync access error and a runtime error', async () => {
const browser = await next.browser(`${pathname}`) const browser = await next.browser(`${pathname}`)
...@@ -566,10 +545,6 @@ export function registerSyncDynamicTests(ctx: CacheComponentsErrorsContext) { ...@@ -566,10 +545,6 @@ export function registerSyncDynamicTests(ctx: CacheComponentsErrorsContext) {
}) })
describe('cookies at runtime', () => { describe('cookies at runtime', () => {
if (skipped) {
return
}
if (isNextDev) { if (isNextDev) {
it('should show a redbox with a sync access error and a runtime error', async () => { it('should show a redbox with a sync access error and a runtime error', async () => {
const browser = await next.browser('/sync-cookies-runtime') const browser = await next.browser('/sync-cookies-runtime')
...@@ -666,10 +641,6 @@ export function registerSyncDynamicTests(ctx: CacheComponentsErrorsContext) { ...@@ -666,10 +641,6 @@ export function registerSyncDynamicTests(ctx: CacheComponentsErrorsContext) {
describe('draftMode', () => { describe('draftMode', () => {
const pathname = '/sync-draft-mode' const pathname = '/sync-draft-mode'
if (skipped) {
return
}
if (isNextDev) { if (isNextDev) {
it('should return `undefined` for `draftMode().isEnabled`', async () => { it('should return `undefined` for `draftMode().isEnabled`', async () => {
const browser = await next.browser(`${pathname}`) const browser = await next.browser(`${pathname}`)
...@@ -720,10 +691,6 @@ export function registerSyncDynamicTests(ctx: CacheComponentsErrorsContext) { ...@@ -720,10 +691,6 @@ export function registerSyncDynamicTests(ctx: CacheComponentsErrorsContext) {
describe('headers', () => { describe('headers', () => {
const pathname = '/sync-headers' const pathname = '/sync-headers'
if (skipped) {
return
}
if (isNextDev) { if (isNextDev) {
it('should show a redbox with a sync access error and a runtime error', async () => { it('should show a redbox with a sync access error and a runtime error', async () => {
const browser = await next.browser(`${pathname}`) const browser = await next.browser(`${pathname}`)
...@@ -898,10 +865,6 @@ export function registerSyncDynamicTests(ctx: CacheComponentsErrorsContext) { ...@@ -898,10 +865,6 @@ export function registerSyncDynamicTests(ctx: CacheComponentsErrorsContext) {
}) })
describe('headers at runtime', () => { describe('headers at runtime', () => {
if (skipped) {
return
}
if (isNextDev) { if (isNextDev) {
it('should show a redbox with a sync access error and a runtime error', async () => { it('should show a redbox with a sync access error and a runtime error', async () => {
const browser = await next.browser('/sync-headers-runtime') const browser = await next.browser('/sync-headers-runtime')
...@@ -998,10 +961,6 @@ export function registerSyncDynamicTests(ctx: CacheComponentsErrorsContext) { ...@@ -998,10 +961,6 @@ export function registerSyncDynamicTests(ctx: CacheComponentsErrorsContext) {
describe('client params', () => { describe('client params', () => {
const pathname = '/sync-client-params' const pathname = '/sync-client-params'
if (skipped) {
return
}
if (isNextDev) { if (isNextDev) {
it('should return `undefined` for `params.slug`', async () => { it('should return `undefined` for `params.slug`', async () => {
const browser = await next.browser(`${pathname}/test`) const browser = await next.browser(`${pathname}/test`)
...@@ -1033,10 +992,6 @@ export function registerSyncDynamicTests(ctx: CacheComponentsErrorsContext) { ...@@ -1033,10 +992,6 @@ export function registerSyncDynamicTests(ctx: CacheComponentsErrorsContext) {
describe('server params', () => { describe('server params', () => {
const pathname = '/sync-server-params' const pathname = '/sync-server-params'
if (skipped) {
return
}
if (isNextDev) { if (isNextDev) {
it('should return `undefined` for `params.slug`', async () => { it('should return `undefined` for `params.slug`', async () => {
const browser = await next.browser(`${pathname}/test`) const browser = await next.browser(`${pathname}/test`)
......
import { isNextDev, nextTestSetup } from 'e2e-utils' import { isNextDev, nextTestSetup } from 'e2e-utils'
describe('Cache Components Errors', () => { describe('Cache Components Errors', () => {
const { next, skipped } = nextTestSetup({ const { next } = nextTestSetup({
files: __dirname + '/fixtures/unstable-deprecations', files: __dirname + '/fixtures/unstable-deprecations',
}) })
if (skipped) {
return
}
describe('Deprecating `unstable` prefix for `cacheLife` and `cacheTag`', () => { describe('Deprecating `unstable` prefix for `cacheLife` and `cacheTag`', () => {
it('warns if you use `cacheLife` through `unstable_cacheLife`', async () => { it('warns if you use `cacheLife` through `unstable_cacheLife`', async () => {
if (isNextDev) { if (isNextDev) {
......
...@@ -9,8 +9,6 @@ import { retry } from 'next-test-utils' ...@@ -9,8 +9,6 @@ import { retry } from 'next-test-utils'
// not implement it yet — its blocking entries still key and bake // not implement it yet — its blocking entries still key and bake
// never-prerenderable params — so deploy runs are limited to adapter // never-prerenderable params — so deploy runs are limited to adapter
// deployments until that ships (see vercel/vercel#17179). // deployments until that ships (see vercel/vercel#17179).
const isAdapterTest = process.env.NEXT_ENABLE_ADAPTER === '1'
type NextInstance = ReturnType<typeof nextTestSetup>['next'] type NextInstance = ReturnType<typeof nextTestSetup>['next']
// A first-principles test matrix for cache components prerendering. // A first-principles test matrix for cache components prerendering.
...@@ -67,7 +65,7 @@ type NextInstance = ReturnType<typeof nextTestSetup>['next'] ...@@ -67,7 +65,7 @@ type NextInstance = ReturnType<typeof nextTestSetup>['next']
// allowQuery, keying and baking them on deployed infra. The fully-static // allowQuery, keying and baking them on deployed infra. The fully-static
// and dynamic matrices pass before and after those fixes and guard them // and dynamic matrices pass before and after those fixes and guard them
// against over-correction. Deploy runs are adapter-only for now (see the // against over-correction. Deploy runs are adapter-only for now (see the
// `skipDeployment` note above the `isAdapterTest` declaration). // `@force-gate !deploy || adapter` on the suite below).
const PARAMS = ['lang', 'category', 'id'] as const const PARAMS = ['lang', 'category', 'id'] as const
type ParamName = (typeof PARAMS)[number] type ParamName = (typeof PARAMS)[number]
...@@ -449,10 +447,12 @@ function createDocumentFetcher(next: NextInstance) { ...@@ -449,10 +447,12 @@ function createDocumentFetcher(next: NextInstance) {
} }
} }
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// No deploy-specific incompatibility is documented.
// @force-gate !deploy || adapter
describe('cache-components-prerender-matrix', () => { describe('cache-components-prerender-matrix', () => {
const { next, isNextDev, isNextDeploy } = nextTestSetup({ const { next, isNextDev, isNextDeploy } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: !isAdapterTest,
}) })
if (isNextDev) { if (isNextDev) {
......
...@@ -38,15 +38,11 @@ function createExpectError(cliOutput: string) { ...@@ -38,15 +38,11 @@ function createExpectError(cliOutput: string) {
describe(`Request Promises`, () => { describe(`Request Promises`, () => {
describe('On Prerender Completion', () => { describe('On Prerender Completion', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname + '/fixtures/reject-hanging-promises-static', files: __dirname + '/fixtures/reject-hanging-promises-static',
skipStart: true, skipStart: true,
}) })
if (skipped) {
return
}
if (isNextDev) { if (isNextDev) {
it('does not run in dev', () => {}) it('does not run in dev', () => {})
return return
...@@ -78,17 +74,15 @@ describe(`Request Promises`, () => { ...@@ -78,17 +74,15 @@ describe(`Request Promises`, () => {
) )
}) })
}) })
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('On Prerender Interruption', () => { describe('On Prerender Interruption', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname + '/fixtures/reject-hanging-promises-dynamic', files: __dirname + '/fixtures/reject-hanging-promises-dynamic',
skipStart: true, skipStart: true,
skipDeployment: true,
}) })
if (skipped) {
return
}
if (isNextDev) { if (isNextDev) {
it('does not run in dev', () => {}) it('does not run in dev', () => {})
return return
......
...@@ -5,17 +5,15 @@ import { ...@@ -5,17 +5,15 @@ import {
getRedboxSource, getRedboxSource,
} from 'next-test-utils' } from 'next-test-utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('cache-components-route-handler-errors', () => { describe('cache-components-route-handler-errors', () => {
const { next, skipped, isNextDev, isTurbopack } = nextTestSetup({ const { next, isNextDev, isTurbopack } = nextTestSetup({
files: __dirname, files: __dirname,
skipStart: true, skipStart: true,
skipDeployment: true,
}) })
if (skipped) {
return
}
it("should error when route handlers use segment configs that aren't supported by cacheComponents", async () => { it("should error when route handlers use segment configs that aren't supported by cacheComponents", async () => {
try { try {
await next.start() await next.start()
......
...@@ -23,30 +23,27 @@ function filterToErrorHeaders(output: string): string { ...@@ -23,30 +23,27 @@ function filterToErrorHeaders(output: string): string {
// Only Turbopack runs the transform on the layout once in edge and non-edge contexts // Only Turbopack runs the transform on the layout once in edge and non-edge contexts
// so we only test this on Turbopack // so we only test this on Turbopack
;(process.env.IS_TURBOPACK_TEST ? describe : describe.skip)( // TODO(deploy-test-completion): Re-enable this suite in deploy mode.
'cache-components-edge-deduplication', // It likely expects a local build failure instead of a successful deployment.
() => { // @force-gate !deploy
const { next, skipped, isNextDev } = nextTestSetup({ // @force-gate turbopack
files: __dirname + '/fixtures/edge-deduplication', describe('cache-components-edge-deduplication', () => {
skipStart: true, const { next, isNextDev } = nextTestSetup({
skipDeployment: true, files: __dirname + '/fixtures/edge-deduplication',
}) skipStart: true,
})
if (skipped) { it('should not duplicate errors when layout is compiled for both edge and non-edge contexts', async () => {
return try {
await next.start()
} catch {
// we expect the build to fail
} }
it('should not duplicate errors when layout is compiled for both edge and non-edge contexts', async () => { if (isNextDev) {
try { const browser = await next.browser('/edge-with-layout/edge')
await next.start() waitForRedbox(browser)
} catch { await expect(browser).toDisplayRedbox(`
// we expect the build to fail
}
if (isNextDev) {
const browser = await next.browser('/edge-with-layout/edge')
waitForRedbox(browser)
await expect(browser).toDisplayRedbox(`
{ {
"description": "Route segment config "dynamic" is not compatible with \`nextConfig.cacheComponents\`. Please remove it.", "description": "Route segment config "dynamic" is not compatible with \`nextConfig.cacheComponents\`. Please remove it.",
"environmentLabel": null, "environmentLabel": null,
...@@ -59,34 +56,33 @@ function filterToErrorHeaders(output: string): string { ...@@ -59,34 +56,33 @@ function filterToErrorHeaders(output: string): string {
} }
`) `)
// Count occurrences of the layout error at the specific location // Count occurrences of the layout error at the specific location
// Filter out browser logs to avoid counting forwarded browser errors // Filter out browser logs to avoid counting forwarded browser errors
const filteredOutput = filterToErrorHeaders(next.cliOutput) const filteredOutput = filterToErrorHeaders(next.cliOutput)
const layoutErrorMatches = filteredOutput.match( const layoutErrorMatches = filteredOutput.match(
/\.\/app\/edge-with-layout\/layout\.tsx:1:14/g /\.\/app\/edge-with-layout\/layout\.tsx:1:14/g
) )
// We don't show an error stack, just the individual error messages at each location // We don't show an error stack, just the individual error messages at each location
expect(layoutErrorMatches.length).toBe(1) expect(layoutErrorMatches.length).toBe(1)
} else { } else {
// Check that both the layout and edge page errors appear // Check that both the layout and edge page errors appear
expect(next.cliOutput).toContain('./app/edge-with-layout/layout.tsx') expect(next.cliOutput).toContain('./app/edge-with-layout/layout.tsx')
expect(next.cliOutput).toContain('./app/edge-with-layout/edge/page.tsx') expect(next.cliOutput).toContain('./app/edge-with-layout/edge/page.tsx')
expect(next.cliOutput).toContain( expect(next.cliOutput).toContain(
'"dynamic" is not compatible with `nextConfig.cacheComponents`. Please remove it.' '"dynamic" is not compatible with `nextConfig.cacheComponents`. Please remove it.'
) )
expect(next.cliOutput).toContain( expect(next.cliOutput).toContain(
'"runtime" is not compatible with `nextConfig.cacheComponents`. Please remove it.' '"runtime" is not compatible with `nextConfig.cacheComponents`. Please remove it.'
) )
// Count occurrences of the layout error at the specific location // Count occurrences of the layout error at the specific location
const layoutErrorMatches = next.cliOutput.match( const layoutErrorMatches = next.cliOutput.match(
/\.\/app\/layout\.tsx:1:14/g /\.\/app\/layout\.tsx:1:14/g
) )
// The location appears once, in the formatted error message. The // The location appears once, in the formatted error message. The
// stack of the build error holds framework frames only, and none of // stack of the build error holds framework frames only, and none of
// them names the route. // them names the route.
expect(layoutErrorMatches.length).toBe(1) expect(layoutErrorMatches.length).toBe(1)
} }
}) })
} })
)
...@@ -6,17 +6,15 @@ import { ...@@ -6,17 +6,15 @@ import {
getRedboxSource, getRedboxSource,
} from 'next-test-utils' } from 'next-test-utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely expects a local build failure instead of a successful deployment.
// @force-gate !deploy
describe('cache-components-segment-configs', () => { describe('cache-components-segment-configs', () => {
const { next, skipped, isNextDev, isTurbopack } = nextTestSetup({ const { next, isNextDev, isTurbopack } = nextTestSetup({
files: __dirname + '/fixtures/default', files: __dirname + '/fixtures/default',
skipStart: true, skipStart: true,
skipDeployment: true,
}) })
if (skipped) {
return
}
it("it should error when using segment configs that aren't supported by cacheComponents", async () => { it("it should error when using segment configs that aren't supported by cacheComponents", async () => {
try { try {
await next.start() await next.start()
......
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// No deploy-specific incompatibility is documented.
// @force-gate !deploy
describe('cache-components', () => { describe('cache-components', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
}) })
if (skipped) {
return
}
it('should partially prerender pages that use connection', async () => { it('should partially prerender pages that use connection', async () => {
let $ = await next.render$('/connection/static-behavior/boundary', {}) let $ = await next.render$('/connection/static-behavior/boundary', {})
if (isNextDev) { if (isNextDev) {
......
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('cache-components', () => { describe('cache-components', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
}) })
if (skipped) {
return
}
it('should partially prerender pages that use cookies', async () => { it('should partially prerender pages that use cookies', async () => {
let $ = await next.render$('/cookies/static-behavior', {}) let $ = await next.render$('/cookies/static-behavior', {})
if (isNextDev) { if (isNextDev) {
......
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
import expect from 'expect' import expect from 'expect'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('cache-components', () => { describe('cache-components', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
}) })
if (skipped) {
return
}
it('should not have route specific errors', async () => { it('should not have route specific errors', async () => {
expect(next.cliOutput).not.toMatch('Error: Route "/') expect(next.cliOutput).not.toMatch('Error: Route "/')
expect(next.cliOutput).not.toMatch('Error occurred prerendering page') expect(next.cliOutput).not.toMatch('Error occurred prerendering page')
......
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('cache-components', () => { describe('cache-components', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
}) })
if (skipped) {
return
}
let cliIndex = 0 let cliIndex = 0
beforeEach(() => { beforeEach(() => {
cliIndex = next.cliOutput.length cliIndex = next.cliOutput.length
......
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('cache-components', () => { describe('cache-components', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
}) })
if (skipped) {
return
}
it('should partially prerender pages that use headers', async () => { it('should partially prerender pages that use headers', async () => {
let $ = await next.render$('/headers/static-behavior', {}) let $ = await next.render$('/headers/static-behavior', {})
if (isNextDev) { if (isNextDev) {
......
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('cache-components', () => { describe('cache-components', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
}) })
if (skipped) {
return
}
it('should not have route specific errors', async () => { it('should not have route specific errors', async () => {
expect(next.cliOutput).not.toMatch('Error: Route "/') expect(next.cliOutput).not.toMatch('Error: Route "/')
expect(next.cliOutput).not.toMatch('Error occurred prerendering page') expect(next.cliOutput).not.toMatch('Error occurred prerendering page')
......
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
// cSpell:words lowcard highcard // cSpell:words lowcard highcard
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('cache-components', () => { describe('cache-components', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
}) })
if (skipped) {
return
}
let cliIndex = 0 let cliIndex = 0
beforeEach(() => { beforeEach(() => {
cliIndex = next.cliOutput.length cliIndex = next.cliOutput.length
......
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('cache-components', () => { describe('cache-components', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
}) })
if (skipped) {
return
}
it('should not have route specific errors', async () => { it('should not have route specific errors', async () => {
expect(next.cliOutput).not.toMatch('Error: Route "/') expect(next.cliOutput).not.toMatch('Error: Route "/')
expect(next.cliOutput).not.toMatch('Error occurred prerendering page') expect(next.cliOutput).not.toMatch('Error occurred prerendering page')
......
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('cache-components', () => { describe('cache-components', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
}) })
if (skipped) {
return
}
let cliIndex = 0 let cliIndex = 0
beforeEach(() => { beforeEach(() => {
cliIndex = next.cliOutput.length cliIndex = next.cliOutput.length
......
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// No deploy-specific incompatibility is documented.
// @force-gate !deploy
describe('cache-components', () => { describe('cache-components', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
}) })
if (skipped) {
return
}
it('should partially prerender pages that await searchParams in a server component', async () => { it('should partially prerender pages that await searchParams in a server component', async () => {
let $ = await next.render$('/search/server/await?sentinel=hello') let $ = await next.render$('/search/server/await?sentinel=hello')
if (isNextDev) { if (isNextDev) {
......
...@@ -5,16 +5,14 @@ import { computeCacheBustingSearchParam } from 'next/dist/shared/lib/router/util ...@@ -5,16 +5,14 @@ import { computeCacheBustingSearchParam } from 'next/dist/shared/lib/router/util
import cheerio from 'cheerio' import cheerio from 'cheerio'
import { fetchViaHTTP, findPort } from 'next-test-utils' import { fetchViaHTTP, findPort } from 'next-test-utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('cache-components', () => { describe('cache-components', () => {
const { next, isNextDev, isNextStart, skipped } = nextTestSetup({ const { next, isNextDev, isNextStart } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
}) })
if (skipped) {
return
}
it('should not have route specific errors', async () => { it('should not have route specific errors', async () => {
expect(next.cliOutput).not.toMatch('Error: Route "/') expect(next.cliOutput).not.toMatch('Error: Route "/')
expect(next.cliOutput).not.toMatch('Error occurred prerendering page') expect(next.cliOutput).not.toMatch('Error occurred prerendering page')
......
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('cache-components', () => { describe('cache-components', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
}) })
if (skipped) {
return
}
it('should not have route specific errors', async () => { it('should not have route specific errors', async () => {
expect(next.cliOutput).not.toMatch('Error: Route "/') expect(next.cliOutput).not.toMatch('Error: Route "/')
expect(next.cliOutput).not.toMatch('Error occurred prerendering page') expect(next.cliOutput).not.toMatch('Error occurred prerendering page')
......
...@@ -5,6 +5,8 @@ describe('custom-cache-control', () => { ...@@ -5,6 +5,8 @@ describe('custom-cache-control', () => {
files: __dirname, files: __dirname,
}) })
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// The hosting platform applies cache headers outside the Next.js server, so deploy mode needs separate expectations.
if (isNextDeploy) { if (isNextDeploy) {
// customizing these headers won't apply on environments // customizing these headers won't apply on environments
// where headers are applied outside of the Next.js server // where headers are applied outside of the Next.js server
......
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
import { retry } from 'next-test-utils' import { retry } from 'next-test-utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('app-dir - draft-mode-middleware', () => { describe('app-dir - draft-mode-middleware', () => {
const { next, skipped } = nextTestSetup({ const { next } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
}) })
if (skipped) {
return
}
it('should be able to enable draft mode with middleware present', async () => { it('should be able to enable draft mode with middleware present', async () => {
const browser = await next.browser( const browser = await next.browser(
'/api/draft?secret=secret-token&slug=preview-page' '/api/draft?secret=secret-token&slug=preview-page'
......
...@@ -2,12 +2,13 @@ import { nextTestSetup } from 'e2e-utils' ...@@ -2,12 +2,13 @@ import { nextTestSetup } from 'e2e-utils'
import { waitForNoErrorToast } from 'next-test-utils' import { waitForNoErrorToast } from 'next-test-utils'
import { join } from 'node:path' import { join } from 'node:path'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('instant validation - opting out of static shells', () => { describe('instant validation - opting out of static shells', () => {
const { next, skipped, isNextDev } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: join(__dirname, 'fixtures', 'valid'), files: join(__dirname, 'fixtures', 'valid'),
skipDeployment: true,
}) })
if (skipped) return
// NOTE: if something's wrong in build, we'll fail before any tests run. // NOTE: if something's wrong in build, we'll fail before any tests run.
// Visiting the pages is mostly just a sanity check. // Visiting the pages is mostly just a sanity check.
...@@ -30,13 +31,14 @@ describe('instant validation - opting out of static shells', () => { ...@@ -30,13 +31,14 @@ describe('instant validation - opting out of static shells', () => {
}) })
describe('instant validation', () => { describe('instant validation', () => {
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('requires a static shell if a below a static layout page is configured as blocking', () => { describe('requires a static shell if a below a static layout page is configured as blocking', () => {
const { next, skipped, isNextDev } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: join(__dirname, 'fixtures', 'invalid-blocking-page-below-static'), files: join(__dirname, 'fixtures', 'invalid-blocking-page-below-static'),
skipStart: true, skipStart: true,
skipDeployment: true,
}) })
if (skipped) return
if (isNextDev) { if (isNextDev) {
beforeAll(() => next.start()) beforeAll(() => next.start())
......
...@@ -4,16 +4,14 @@ import { ...@@ -4,16 +4,14 @@ import {
RSC_HEADER, RSC_HEADER,
} from 'next/dist/client/components/app-router-headers' } from 'next/dist/client/components/app-router-headers'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// No deploy-specific incompatibility is documented.
// @force-gate !deploy
describe('non-rsc-router-prefetch', () => { describe('non-rsc-router-prefetch', () => {
const { next, skipped } = nextTestSetup({ const { next } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
}) })
if (skipped) {
return
}
beforeAll(async () => { beforeAll(async () => {
const res = await next.fetch('/') const res = await next.fetch('/')
await res.text() await res.text()
......
...@@ -2,14 +2,13 @@ import cheerio from 'cheerio' ...@@ -2,14 +2,13 @@ import cheerio from 'cheerio'
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
import { splitResponseWithPPRSentinel } from 'e2e-utils/ppr' import { splitResponseWithPPRSentinel } from 'e2e-utils/ppr'
const isAdapterTest = process.env.NEXT_ENABLE_ADAPTER === '1' // TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// The latest changes to support this behavior on deployed infra are available in the adapter,
// and are not being backported to the CLI
// @force-gate !deploy || adapter
describe('partial-fallback-root-blocking', () => { describe('partial-fallback-root-blocking', () => {
const { next, isNextDev, isNextDeploy } = nextTestSetup({ const { next, isNextDev, isNextDeploy } = nextTestSetup({
files: __dirname, files: __dirname,
// The latest changes to support this behavior on deployed infra are available in the adapter,
// and are not being backported to the CLI
skipDeployment: !isAdapterTest,
}) })
if (isNextDev) { if (isNextDev) {
......
...@@ -4,8 +4,6 @@ import { splitResponseWithPPRSentinel } from 'e2e-utils/ppr' ...@@ -4,8 +4,6 @@ import { splitResponseWithPPRSentinel } from 'e2e-utils/ppr'
import { retry, waitFor } from 'next-test-utils' import { retry, waitFor } from 'next-test-utils'
import path from 'path' import path from 'path'
const isAdapterTest = process.env.NEXT_ENABLE_ADAPTER === '1'
type NextInstance = ReturnType<typeof nextTestSetup>['next'] type NextInstance = ReturnType<typeof nextTestSetup>['next']
function createSplitHTMLFetcher(next: NextInstance) { function createSplitHTMLFetcher(next: NextInstance) {
...@@ -32,14 +30,15 @@ function createSplitHTMLFetcher(next: NextInstance) { ...@@ -32,14 +30,15 @@ function createSplitHTMLFetcher(next: NextInstance) {
} }
} }
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// The latest changes to support this behavior on deployed infra are available in the adapter,
// and are not being backported to the CLI
// @force-gate !deploy || adapter
describe('partial-fallback-shell-upgrade', () => { describe('partial-fallback-shell-upgrade', () => {
const { next, isNextDev } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
// Deployed shell upgrades require `partialFallback` metadata, which the // Deployed shell upgrades require `partialFallback` metadata, which the
// adapter only emits when Partial Prefetching is enabled in the fixture. // adapter only emits when Partial Prefetching is enabled in the fixture.
files: path.join(__dirname, 'fixtures', 'default'), files: path.join(__dirname, 'fixtures', 'default'),
// The latest changes to support this behavior on deployed infra are available in the adapter,
// and are not being backported to the CLI
skipDeployment: !isAdapterTest,
}) })
if (isNextDev) { if (isNextDev) {
...@@ -171,12 +170,13 @@ describe('partial-fallback-shell-upgrade', () => { ...@@ -171,12 +170,13 @@ describe('partial-fallback-shell-upgrade', () => {
}) })
}) })
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// The latest changes to support this behavior on deployed infra are available in the adapter,
// and are not being backported to the CLI
// @force-gate !deploy || adapter
describe('partial-fallback-shell-upgrade - partialPrefetching disabled', () => { describe('partial-fallback-shell-upgrade - partialPrefetching disabled', () => {
const { next, isNextDev } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: path.join(__dirname, 'fixtures', 'partial-prefetching-disabled'), files: path.join(__dirname, 'fixtures', 'partial-prefetching-disabled'),
// The latest changes to support this behavior on deployed infra are available in the adapter,
// and are not being backported to the CLI
skipDeployment: !isAdapterTest,
}) })
if (isNextDev) { if (isNextDev) {
......
...@@ -5,18 +5,18 @@ function countSubstring(str: string, substr: string): number { ...@@ -5,18 +5,18 @@ function countSubstring(str: string, substr: string): number {
} }
// TODO(NAR-423): Migrate to Cache Components. // TODO(NAR-423): Migrate to Cache Components.
describe.skip('ppr-metadata-blocking-ppr-fallback', () => { // TODO(deploy-test-completion): Re-enable this suite in deploy mode.
const { next, skipped } = nextTestSetup({ // Need to skip deployment because the test uses the private env cannot be used in deployment
// @force-gate !deploy
// @force-gate TODO
describe('ppr-metadata-blocking-ppr-fallback', () => {
const { next } = nextTestSetup({
files: __dirname, files: __dirname,
// Need to skip deployment because the test uses the private env cannot be used in deployment
skipDeployment: true,
env: { env: {
__NEXT_EXPERIMENTAL_STATIC_SHELL_DEBUGGING: '1', __NEXT_EXPERIMENTAL_STATIC_SHELL_DEBUGGING: '1',
}, },
}) })
if (skipped) return
it('should not include metadata in partial shell when page is fully dynamic', async () => { it('should not include metadata in partial shell when page is fully dynamic', async () => {
const $ = await next.render$('/fully-dynamic?__nextppronly=fallback') const $ = await next.render$('/fully-dynamic?__nextppronly=fallback')
expect(countSubstring($.html(), '<title>')).toBe(0) expect(countSubstring($.html(), '<title>')).toBe(0)
......
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
import path from 'path' import path from 'path'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely expects a local build failure instead of a successful deployment.
// @force-gate !deploy
describe('ppr-missing-root-params (single)', () => { describe('ppr-missing-root-params (single)', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: path.join(__dirname, 'fixtures/single'), files: path.join(__dirname, 'fixtures/single'),
skipStart: true, skipStart: true,
skipDeployment: true,
}) })
if (skipped) return
beforeAll(async () => { beforeAll(async () => {
try { try {
...@@ -26,13 +27,14 @@ describe('ppr-missing-root-params (single)', () => { ...@@ -26,13 +27,14 @@ describe('ppr-missing-root-params (single)', () => {
}) })
}) })
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely expects a local build failure instead of a successful deployment.
// @force-gate !deploy
describe('ppr-missing-root-params (multiple)', () => { describe('ppr-missing-root-params (multiple)', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: path.join(__dirname, 'fixtures/multiple'), files: path.join(__dirname, 'fixtures/multiple'),
skipStart: true, skipStart: true,
skipDeployment: true,
}) })
if (skipped) return
beforeAll(async () => { beforeAll(async () => {
try { try {
...@@ -51,13 +53,14 @@ describe('ppr-missing-root-params (multiple)', () => { ...@@ -51,13 +53,14 @@ describe('ppr-missing-root-params (multiple)', () => {
}) })
}) })
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely expects a local build failure instead of a successful deployment.
// @force-gate !deploy
describe('ppr-missing-root-params (nested)', () => { describe('ppr-missing-root-params (nested)', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: path.join(__dirname, 'fixtures/nested'), files: path.join(__dirname, 'fixtures/nested'),
skipStart: true, skipStart: true,
skipDeployment: true,
}) })
if (skipped) return
beforeAll(async () => { beforeAll(async () => {
try { try {
......
...@@ -4,6 +4,7 @@ import { createTestDataServer } from 'test-data-service/writer' ...@@ -4,6 +4,7 @@ import { createTestDataServer } from 'test-data-service/writer'
import { createTestLog } from 'test-log' import { createTestLog } from 'test-log'
describe('avoid-popstate-flash', () => { describe('avoid-popstate-flash', () => {
// Deploy mode exclusion: This suite depends on a test-data service running on a local port.
if ((global as any).isNextDev || (global as any).isNextDeploy) { if ((global as any).isNextDev || (global as any).isNextDeploy) {
// this is skipped in dev because PPR is not enabled in dev // this is skipped in dev because PPR is not enabled in dev
// and in deploy we can't rely on this test data service existing // and in deploy we can't rely on this test data service existing
......
...@@ -4,6 +4,7 @@ import { createTestDataServer } from 'test-data-service/writer' ...@@ -4,6 +4,7 @@ import { createTestDataServer } from 'test-data-service/writer'
import { createTestLog } from 'test-log' import { createTestLog } from 'test-log'
describe('stale-prefetch-entry', () => { describe('stale-prefetch-entry', () => {
// Deploy mode exclusion: This suite depends on a test-data service running on a local port.
if ((global as any).isNextDev || (global as any).isNextDeploy) { if ((global as any).isNextDev || (global as any).isNextDeploy) {
// this is skipped in dev because PPR is not enabled in dev // this is skipped in dev because PPR is not enabled in dev
// and in deploy we can't rely on this test data service existing // and in deploy we can't rely on this test data service existing
......
...@@ -7,15 +7,16 @@ ...@@ -7,15 +7,16 @@
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
import { retry } from 'next-test-utils' import { retry } from 'next-test-utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// the file-patching strategy we use for synchronizing the test doesn't work
// on deployments
// @force-gate !deploy
describe('PPR - partial hydration', () => { describe('PPR - partial hydration', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname, files: __dirname,
// the file-patching strategy we use for synchronizing the test doesn't work
// on deployments
skipDeployment: true,
}) })
if (isNextDev || skipped) { if (isNextDev) {
it.skip('only testable in production (non-deployment)', () => {}) it.skip('only testable in production (non-deployment)', () => {})
return return
} }
......
...@@ -3,6 +3,7 @@ import { findPort } from 'next-test-utils' ...@@ -3,6 +3,7 @@ import { findPort } from 'next-test-utils'
import http from 'node:http' import http from 'node:http'
describe('ppr-unstable-cache', () => { describe('ppr-unstable-cache', () => {
// Deploy mode exclusion: This suite starts a local HTTP data server on a dynamically allocated port.
if (isNextDeploy) { if (isNextDeploy) {
it.skip('should not run in deploy mode', () => {}) it.skip('should not run in deploy mode', () => {})
return return
......
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
// TODO(deploy-test-completion): Remove this suite from the deploy manifest.
// It was excluded as a known deploy failure without a documented root cause.
describe('app-dir revalidate-dynamic', () => { describe('app-dir revalidate-dynamic', () => {
const { next, isNextStart } = nextTestSetup({ const { next, isNextStart } = nextTestSetup({
files: __dirname, files: __dirname,
......
...@@ -7,6 +7,8 @@ import { isNextDeploy, isNextDev, nextTestSetup } from 'e2e-utils' ...@@ -7,6 +7,8 @@ import { isNextDeploy, isNextDev, nextTestSetup } from 'e2e-utils'
import { createFakeCDN } from './server.mjs' import { createFakeCDN } from './server.mjs'
describe('segment cache (CDN cache busting)', () => { describe('segment cache (CDN cache busting)', () => {
// Deploy mode exclusion: This suite runs Next.js behind an in-process fake
// CDN on local ports.
if (isNextDev || isNextDeploy) { if (isNextDev || isNextDeploy) {
test('should not run during dev or deploy test runs', () => {}) test('should not run during dev or deploy test runs', () => {})
return return
......
...@@ -7,6 +7,8 @@ describe('segment cache prefetch fallback retry', () => { ...@@ -7,6 +7,8 @@ describe('segment cache prefetch fallback retry', () => {
const { next, isNextDev, isNextDeploy } = nextTestSetup({ const { next, isNextDev, isNextDeploy } = nextTestSetup({
files: __dirname, files: __dirname,
}) })
// Deploy mode exclusion: This suite requires direct observation and control
// of local ISR cache state and background regeneration.
if (isNextDev || isNextDeploy) { if (isNextDev || isNextDeploy) {
// Prefetching is disabled in dev, and the recovery test relies on // Prefetching is disabled in dev, and the recovery test relies on
// observing ISR cache state and background regeneration, which aren't // observing ISR cache state and background regeneration, which aren't
......
...@@ -6,6 +6,8 @@ import { createTestLog } from 'test-log' ...@@ -6,6 +6,8 @@ import { createTestLog } from 'test-log'
import { findPort } from 'next-test-utils' import { findPort } from 'next-test-utils'
describe('segment cache (revalidation)', () => { describe('segment cache (revalidation)', () => {
// Deploy mode exclusion: This suite starts and mutates a process-local test
// data server.
if (isNextDev || isNextDeploy) { if (isNextDev || isNextDeploy) {
test('disabled in development / deployment', () => {}) test('disabled in development / deployment', () => {})
return return
......
...@@ -4,12 +4,12 @@ import { createRouterAct } from 'router-act' ...@@ -4,12 +4,12 @@ import { createRouterAct } from 'router-act'
import { UNEXPECTED_CACHE_MISS_MESSAGE } from 'next/src/server/use-cache/use-cache-errors' import { UNEXPECTED_CACHE_MISS_MESSAGE } from 'next/src/server/use-cache/use-cache-errors'
// Deploy mode exclusion: This suite asserts local server CLI output.
// @force-gate !deploy
describe('runtime prerender cache warming', () => { describe('runtime prerender cache warming', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true, // reads CLI output
}) })
if (skipped) return
if (isNextDev) { if (isNextDev) {
it.skip('no prefetching in dev', () => {}) it.skip('no prefetching in dev', () => {})
......
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
// TODO(NAR-423): Migrate to Cache Components. // TODO(NAR-423): Migrate to Cache Components.
describe.skip('static-shell-debugging', () => { // TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// This test skips deployment because env vars that are doubled underscore prefixed
// are not supported. This is also intended to be used in development.
// @force-gate !deploy
// @force-gate TODO
describe('static-shell-debugging', () => {
const cacheComponents = Boolean(process.env.__NEXT_CACHE_COMPONENTS) const cacheComponents = Boolean(process.env.__NEXT_CACHE_COMPONENTS)
const context = { const context = {
cacheComponents, cacheComponents,
debugging: cacheComponents, debugging: cacheComponents,
} }
const { next, skipped, isNextDev } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname, files: __dirname,
// This test skips deployment because env vars that are doubled underscore prefixed
// are not supported. This is also intended to be used in development.
skipDeployment: true,
env: { env: {
__NEXT_EXPERIMENTAL_STATIC_SHELL_DEBUGGING: context.debugging __NEXT_EXPERIMENTAL_STATIC_SHELL_DEBUGGING: context.debugging
? '1' ? '1'
...@@ -23,8 +25,6 @@ describe.skip('static-shell-debugging', () => { ...@@ -23,8 +25,6 @@ describe.skip('static-shell-debugging', () => {
}, },
}) })
if (skipped) return
if (context.debugging && context.cacheComponents) { if (context.debugging && context.cacheComponents) {
it('should only render the static shell', async () => { it('should only render the static shell', async () => {
const res = await next.fetch('/?__nextppronly=1') const res = await next.fetch('/?__nextppronly=1')
......
...@@ -4,10 +4,12 @@ import { createRouterAct } from '../../../lib/router-act' ...@@ -4,10 +4,12 @@ import { createRouterAct } from '../../../lib/router-act'
import { setTimeout } from 'timers/promises' import { setTimeout } from 'timers/promises'
import { retry } from '../../../lib/next-test-utils' import { retry } from '../../../lib/next-test-utils'
// Deploy mode exclusion: This suite asserts local CLI or runtime logs that deployments do not expose.
// reads cli logs
// @force-gate !deploy
describe('use cache called after tasky uncached IO', () => { describe('use cache called after tasky uncached IO', () => {
const { next, isNextStart } = nextTestSetup({ const { next, isNextStart } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true, // reads cli logs
}) })
if (isNextStart) { if (isNextStart) {
......
...@@ -7,17 +7,15 @@ import { ...@@ -7,17 +7,15 @@ import {
} from 'next-test-utils' } from 'next-test-utils'
import stripAnsi from 'strip-ansi' import stripAnsi from 'strip-ansi'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('use-cache-close-over-function', () => { describe('use-cache-close-over-function', () => {
const { next, isNextDev, isTurbopack, skipped } = nextTestSetup({ const { next, isNextDev, isTurbopack } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
skipStart: process.env.NEXT_TEST_MODE !== 'dev', skipStart: process.env.NEXT_TEST_MODE !== 'dev',
}) })
if (skipped) {
return
}
if (isNextDev) { if (isNextDev) {
it('should show an error toast for client-side usage', async () => { it('should show an error toast for client-side usage', async () => {
const outputIndex = next.cliOutput.length const outputIndex = next.cliOutput.length
......
...@@ -8,17 +8,15 @@ function expectedTimeoutErrorMessage(route: string) { ...@@ -8,17 +8,15 @@ function expectedTimeoutErrorMessage(route: string) {
return `Route "${route}": ${timeoutErrorMessage}` return `Route "${route}": ${timeoutErrorMessage}`
} }
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('use-cache-configured-timeout', () => { describe('use-cache-configured-timeout', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
skipStart: process.env.NEXT_TEST_MODE !== 'dev', skipStart: process.env.NEXT_TEST_MODE !== 'dev',
}) })
if (skipped) {
return
}
if (isNextDev) { if (isNextDev) {
describe('when a "use cache" fill is below the configured dev `useCacheTimeout`', () => { describe('when a "use cache" fill is below the configured dev `useCacheTimeout`', () => {
it('should not clamp the dev timeout and allow the cache fill to complete', async () => { it('should not clamp the dev timeout and allow the cache fill to complete', async () => {
......
...@@ -3,15 +3,14 @@ import { retry } from 'next-test-utils' ...@@ -3,15 +3,14 @@ import { retry } from 'next-test-utils'
const isoDateRegExp = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/ const isoDateRegExp = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// Skip deployment so we can test the custom cache handlers log output
// @force-gate !deploy
describe('use-cache-custom-handler', () => { describe('use-cache-custom-handler', () => {
const { next, skipped, isNextStart } = nextTestSetup({ const { next, isNextStart } = nextTestSetup({
files: __dirname, files: __dirname,
// Skip deployment so we can test the custom cache handlers log output
skipDeployment: true,
}) })
if (skipped) return
let outputIndex: number let outputIndex: number
beforeEach(() => { beforeEach(() => {
......
...@@ -24,19 +24,18 @@ function expectedDeadlockMessage(route: string) { ...@@ -24,19 +24,18 @@ function expectedDeadlockMessage(route: string) {
// than detected as a deadlock. Revisit by surfacing these deadlocks at build // than detected as a deadlock. Revisit by surfacing these deadlocks at build
// time via `next build --debug-prerender`, then re-enable (and retarget) this // time via `next build --debug-prerender`, then re-enable (and retarget) this
// suite. // suite.
describe.skip('use-cache-deadlock-probe', () => { // TODO(deploy-test-completion): Re-enable this suite in deploy mode.
const { next, isNextDev, skipped } = nextTestSetup({ // It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
// @force-gate TODO
describe('use-cache-deadlock-probe', () => {
const { next, isNextDev } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
// Probe behavior is dev-only; skip the production server start, but // Probe behavior is dev-only; skip the production server start, but
// let dev mode auto-start. // let dev mode auto-start.
skipStart: process.env.NEXT_TEST_MODE !== 'dev', skipStart: process.env.NEXT_TEST_MODE !== 'dev',
}) })
if (skipped) {
return
}
if (!isNextDev) { if (!isNextDev) {
it('is a dev-only suite', () => {}) it('is a dev-only suite', () => {})
return return
......
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
import { retry } from 'next-test-utils' import { retry } from 'next-test-utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('use-cache-default-handler-expire-zero', () => { describe('use-cache-default-handler-expire-zero', () => {
const { next, skipped, isNextStart } = nextTestSetup({ const { next, isNextStart } = nextTestSetup({
files: __dirname, files: __dirname,
// Enable the built-in default cache handler's debug logging so we can // Enable the built-in default cache handler's debug logging so we can
// assert on its `set()` decisions in the CLI output. That output is not // assert on its `set()` decisions in the CLI output. That output is not
// available on deploy, so skip the deploy variant. // available on deploy, so skip the deploy variant.
env: { NEXT_PRIVATE_DEBUG_CACHE: '1' }, env: { NEXT_PRIVATE_DEBUG_CACHE: '1' },
skipDeployment: true,
}) })
if (skipped) {
return
}
if (isNextStart) { if (isNextStart) {
it('does not save an expire:0 cache to the built-in default handler, but saves a short-lived one', async () => { it('does not save an expire:0 cache to the built-in default handler, but saves a short-lived one', async () => {
const browser = await next.browser('/') const browser = await next.browser('/')
......
...@@ -17,17 +17,15 @@ function expectedTimeoutErrorMessage(route: string) { ...@@ -17,17 +17,15 @@ function expectedTimeoutErrorMessage(route: string) {
return `Route "${route}": ${timeoutErrorMessage}` return `Route "${route}": ${timeoutErrorMessage}`
} }
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('use-cache-hanging-inputs', () => { describe('use-cache-hanging-inputs', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
skipStart: process.env.NEXT_TEST_MODE !== 'dev', skipStart: process.env.NEXT_TEST_MODE !== 'dev',
}) })
if (skipped) {
return
}
if (isNextDev) { if (isNextDev) {
// TODO(restart-on-cache-miss): reenable when fixed // TODO(restart-on-cache-miss): reenable when fixed
describe.skip('when an uncached promise is used inside of "use cache"', () => { describe.skip('when an uncached promise is used inside of "use cache"', () => {
......
...@@ -9,17 +9,15 @@ function expectedTimeoutErrorMessage(route: string) { ...@@ -9,17 +9,15 @@ function expectedTimeoutErrorMessage(route: string) {
return `Route "${route}": ${timeoutErrorMessage}` return `Route "${route}": ${timeoutErrorMessage}`
} }
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('use-cache-hanging', () => { describe('use-cache-hanging', () => {
const { next, isNextDev, skipped, isTurbopack } = nextTestSetup({ const { next, isNextDev, isTurbopack } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
skipStart: process.env.NEXT_TEST_MODE !== 'dev', skipStart: process.env.NEXT_TEST_MODE !== 'dev',
}) })
if (skipped) {
return
}
if (isNextDev) { if (isNextDev) {
describe('when a "use cache" fill hangs in the static stage', () => { describe('when a "use cache" fill hangs in the static stage', () => {
it('should show an error after a timeout', async () => { it('should show an error after a timeout', async () => {
......
...@@ -3,11 +3,12 @@ import { nextTestSetup } from 'e2e-utils' ...@@ -3,11 +3,12 @@ import { nextTestSetup } from 'e2e-utils'
const uuidRegExp = const uuidRegExp =
/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/ /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// Deployment platforms provide their own cache handlers.
// @force-gate !deploy
describe('use-cache-infinity-profile', () => { describe('use-cache-infinity-profile', () => {
const { next, isNextStart } = nextTestSetup({ const { next, isNextStart } = nextTestSetup({
files: __dirname, files: __dirname,
// Deployment platforms provide their own cache handlers.
skipDeployment: true,
}) })
it('caches forever with a configured profile using Infinity revalidate and expire', async () => { it('caches forever with a configured profile using Infinity revalidate and expire', async () => {
......
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// The prerendered output can't be observed in a deployment, and without
// it nothing distinguishes broken from fixed behavior.
// @force-gate !deploy
describe('use-cache-og-image-top-level-await', () => { describe('use-cache-og-image-top-level-await', () => {
const { next, isNextStart, skipped } = nextTestSetup({ const { next, isNextStart } = nextTestSetup({
files: __dirname, files: __dirname,
skipStart: true, skipStart: true,
// The prerendered output can't be observed in a deployment, and without
// it nothing distinguishes broken from fixed behavior.
skipDeployment: true,
}) })
if (skipped) {
return
}
if (isNextStart) { if (isNextStart) {
beforeAll(async () => { beforeAll(async () => {
await next.build({ args: ['--experimental-build-mode', 'compile'] }) await next.build({ args: ['--experimental-build-mode', 'compile'] })
......
...@@ -3,10 +3,12 @@ import { renderViaHTTP, startCleanStaticServer } from 'next-test-utils' ...@@ -3,10 +3,12 @@ import { renderViaHTTP, startCleanStaticServer } from 'next-test-utils'
import { join } from 'path' import { join } from 'path'
import { AddressInfo, Server } from 'net' import { AddressInfo, Server } from 'net'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('use-cache-output-export', () => { describe('use-cache-output-export', () => {
const { next, isNextStart } = nextTestSetup({ const { next, isNextStart } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
skipStart: process.env.NEXT_TEST_MODE !== 'dev', skipStart: process.env.NEXT_TEST_MODE !== 'dev',
}) })
......
...@@ -5,17 +5,15 @@ import stripAnsi from 'strip-ansi' ...@@ -5,17 +5,15 @@ import stripAnsi from 'strip-ansi'
const getExpectedErrorMessage = (route: string) => const getExpectedErrorMessage = (route: string) =>
`Route "${route}": \`searchParams\` can't be read inside \`"use cache"\`. Await it outside the cached function and pass what you need as an argument.\nLearn more: https://nextjs.org/docs/messages/next-request-in-use-cache` `Route "${route}": \`searchParams\` can't be read inside \`"use cache"\`. Await it outside the cached function and pass what you need as an argument.\nLearn more: https://nextjs.org/docs/messages/next-request-in-use-cache`
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('use-cache-search-params', () => { describe('use-cache-search-params', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
skipStart: process.env.NEXT_TEST_MODE !== 'dev', skipStart: process.env.NEXT_TEST_MODE !== 'dev',
}) })
if (skipped) {
return
}
if (isNextDev) { if (isNextDev) {
let route: string let route: string
......
...@@ -2,17 +2,15 @@ import { nextTestSetup } from 'e2e-utils' ...@@ -2,17 +2,15 @@ import { nextTestSetup } from 'e2e-utils'
import { waitForRedbox } from 'next-test-utils' import { waitForRedbox } from 'next-test-utils'
import stripAnsi from 'strip-ansi' import stripAnsi from 'strip-ansi'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely expects a local build failure instead of a successful deployment.
// @force-gate !deploy
describe('use-cache-segment-configs', () => { describe('use-cache-segment-configs', () => {
const { next, skipped, isNextDev, isTurbopack, isRspack } = nextTestSetup({ const { next, isNextDev, isTurbopack, isRspack } = nextTestSetup({
files: __dirname, files: __dirname,
skipStart: process.env.NEXT_TEST_MODE !== 'dev', skipStart: process.env.NEXT_TEST_MODE !== 'dev',
skipDeployment: true,
}) })
if (skipped) {
return
}
it("it should error when using segment configs that aren't supported by useCache", async () => { it("it should error when using segment configs that aren't supported by useCache", async () => {
if (isNextDev) { if (isNextDev) {
const browser = await next.browser('/runtime') const browser = await next.browser('/runtime')
......
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
import { retry } from 'next-test-utils' import { retry } from 'next-test-utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('use-cache-swr', () => { describe('use-cache-swr', () => {
const { next, skipped, isNextDev } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
}) })
if (skipped) return
let outputIndex: number let outputIndex: number
beforeEach(() => { beforeEach(() => {
......
...@@ -9,17 +9,15 @@ import { ...@@ -9,17 +9,15 @@ import {
import stripAnsi from 'strip-ansi' import stripAnsi from 'strip-ansi'
import { createSandbox } from 'development-sandbox' import { createSandbox } from 'development-sandbox'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely expects a local build failure instead of a successful deployment.
// @force-gate !deploy
describe('use-cache-unknown-cache-kind', () => { describe('use-cache-unknown-cache-kind', () => {
const { next, isNextStart, isTurbopack, isRspack, skipped } = nextTestSetup({ const { next, isNextStart, isTurbopack, isRspack } = nextTestSetup({
files: __dirname, files: __dirname,
skipStart: process.env.NEXT_TEST_MODE !== 'dev', skipStart: process.env.NEXT_TEST_MODE !== 'dev',
skipDeployment: true,
}) })
if (skipped) {
return
}
if (isNextStart) { if (isNextStart) {
beforeAll(async () => { beforeAll(async () => {
await next.build() await next.build()
......
...@@ -13,17 +13,15 @@ const nextConfigWithUseCache: NextConfig = { ...@@ -13,17 +13,15 @@ const nextConfigWithUseCache: NextConfig = {
experimental: { useCache: true }, experimental: { useCache: true },
} }
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely expects a local build failure instead of a successful deployment.
// @force-gate !deploy
describe('use-cache-without-experimental-flag', () => { describe('use-cache-without-experimental-flag', () => {
const { next, isNextStart, isTurbopack, skipped, isRspack } = nextTestSetup({ const { next, isNextStart, isTurbopack, isRspack } = nextTestSetup({
files: __dirname, files: __dirname,
skipStart: process.env.NEXT_TEST_MODE !== 'dev', skipStart: process.env.NEXT_TEST_MODE !== 'dev',
skipDeployment: true,
}) })
if (skipped) {
return
}
if (isNextStart) { if (isNextStart) {
it('should fail the build with an error', async () => { it('should fail the build with an error', async () => {
const { cliOutput } = await next.build() const { cliOutput } = await next.build()
......
...@@ -19,17 +19,13 @@ const GENERIC_RSC_ERROR = ...@@ -19,17 +19,13 @@ const GENERIC_RSC_ERROR =
const withCacheComponents = process.env.__NEXT_CACHE_COMPONENTS === 'true' const withCacheComponents = process.env.__NEXT_CACHE_COMPONENTS === 'true'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('use-cache', () => { describe('use-cache', () => {
const { next, isNextDev, isNextDeploy, isNextStart, skipped } = nextTestSetup( const { next, isNextDev, isNextDeploy, isNextStart } = nextTestSetup({
{ files: __dirname,
files: __dirname, })
skipDeployment: true,
}
)
if (skipped) {
return
}
let cliOutputLength: number let cliOutputLength: number
......
...@@ -3,16 +3,14 @@ import { retry } from 'next-test-utils' ...@@ -3,16 +3,14 @@ import { retry } from 'next-test-utils'
import { join } from 'path' import { join } from 'path'
describe('cache-handlers-upstream-wiring', () => { describe('cache-handlers-upstream-wiring', () => {
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('pages router non-edge', () => { describe('pages router non-edge', () => {
const { next, skipped, isNextDev } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: join(__dirname, 'fixtures/pages-router-non-edge'), files: join(__dirname, 'fixtures/pages-router-non-edge'),
skipDeployment: true,
}) })
if (skipped) {
return
}
let outputIndex = 0 let outputIndex = 0
beforeEach(() => { beforeEach(() => {
...@@ -51,16 +49,14 @@ describe('cache-handlers-upstream-wiring', () => { ...@@ -51,16 +49,14 @@ describe('cache-handlers-upstream-wiring', () => {
}) })
}) })
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('cacheComponents enabled, non-edge app router', () => { describe('cacheComponents enabled, non-edge app router', () => {
const { next, skipped, isNextDev } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: join(__dirname, 'fixtures/non-edge-cache-components'), files: join(__dirname, 'fixtures/non-edge-cache-components'),
skipDeployment: true,
}) })
if (skipped) {
return
}
let outputIndex = 0 let outputIndex = 0
beforeEach(() => { beforeEach(() => {
...@@ -98,17 +94,15 @@ describe('cache-handlers-upstream-wiring', () => { ...@@ -98,17 +94,15 @@ describe('cache-handlers-upstream-wiring', () => {
}) })
}) })
}) })
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
// @force-gate !cacheComponents // @force-gate !cacheComponents
describe('cacheComponents disabled, edge app router', () => { describe('cacheComponents disabled, edge app router', () => {
const { next, skipped } = nextTestSetup({ const { next } = nextTestSetup({
files: join(__dirname, 'fixtures/edge-without-cache-components'), files: join(__dirname, 'fixtures/edge-without-cache-components'),
skipDeployment: true,
}) })
if (skipped) {
return
}
let outputIndex = 0 let outputIndex = 0
beforeEach(() => { beforeEach(() => {
......
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
import { retry } from 'next-test-utils' import { retry } from 'next-test-utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('custom-cache-handler-image', () => { describe('custom-cache-handler-image', () => {
const { next, skipped } = nextTestSetup({ const { next } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
env: { env: {
// Set max cache entries to 2 to easily test eviction // Set max cache entries to 2 to easily test eviction
MAX_IMAGE_CACHE_ENTRIES: '2', MAX_IMAGE_CACHE_ENTRIES: '2',
}, },
}) })
if (skipped) {
return
}
it('should use custom cache handler for image optimization', async () => { it('should use custom cache handler for image optimization', async () => {
// First, render the page to get the image URLs // First, render the page to get the image URLs
const $ = await next.render$('/') const $ = await next.render$('/')
......
...@@ -12,12 +12,17 @@ function getData(html: string) { ...@@ -12,12 +12,17 @@ function getData(html: string) {
} }
} }
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely expects a local build failure instead of a successful deployment.
// @force-gate !deploy
describe('Test Draft Mode', () => { describe('Test Draft Mode', () => {
const { next, isNextDev, isNextStart, skipped } = nextTestSetup({ const { next, isNextDev, isNextStart, isNextDeploy } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
}) })
if (skipped) return
if (isNextDeploy) {
it('is excluded from deploy testing by @force-gate', () => {})
}
if (isNextDev) { if (isNextDev) {
it('should start development application', async () => { it('should start development application', async () => {
......
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
import cheerio from 'cheerio' import cheerio from 'cheerio'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// Assertions don't apply to deploy mode (output differs vs. local Next.js server).
// @force-gate !deploy
describe('fallback: false rewrite', () => { describe('fallback: false rewrite', () => {
const { next, skipped } = nextTestSetup({ const { next } = nextTestSetup({
files: __dirname, files: __dirname,
// Assertions don't apply to deploy mode (output differs vs. local Next.js server).
skipDeployment: true,
}) })
if (skipped) return
it('should rewrite correctly for path at same level as fallback: false SSR', async () => { it('should rewrite correctly for path at same level as fallback: false SSR', async () => {
const res = await next.fetch('/hello', { redirect: 'manual' }) const res = await next.fetch('/hello', { redirect: 'manual' })
......
import { nextTestSetup, isNextStart } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
import fs from 'fs/promises' import fs from 'fs/promises'
import path from 'path' import path from 'path'
...@@ -9,109 +9,106 @@ import path from 'path' ...@@ -9,109 +9,106 @@ import path from 'path'
// This is a Turbopack + build (start) mode test. It runs `next build` with // This is a Turbopack + build (start) mode test. It runs `next build` with
// controlled local and CI environments and checks whether anything is written // controlled local and CI environments and checks whether anything is written
// to `.next/cache/turbopack`. // to `.next/cache/turbopack`.
;(process.env.IS_TURBOPACK_TEST && isNextStart ? describe : describe.skip)( // TODO(deploy-test-completion): Re-enable this suite in deploy mode.
'filesystem-cache build default', // It likely mutates files in the isolated local fixture after setup.
() => { // @force-gate !deploy
const { next, skipped } = nextTestSetup({ // @force-gate turbopack
files: __dirname, // @force-gate start
skipStart: true, describe('filesystem-cache build default', () => {
skipDeployment: true, const { next } = nextTestSetup({
}) files: __dirname,
skipStart: true,
if (skipped) { })
return
} // Simulate a non-CI (local) environment by clearing the common CI signals.
const NON_CI_ENV = {
// Simulate a non-CI (local) environment by clearing the common CI signals. CI: '',
const NON_CI_ENV = { CONTINUOUS_INTEGRATION: '',
CI: '', BUILD_NUMBER: '',
CONTINUOUS_INTEGRATION: '', RUN_ID: '',
BUILD_NUMBER: '', GITHUB_ACTIONS: '',
RUN_ID: '', NOW_BUILDER: '',
GITHUB_ACTIONS: '', // Persist even a tiny snapshot so the assertion doesn't depend on the
NOW_BUILDER: '', // minimum-compilation-time threshold.
// Persist even a tiny snapshot so the assertion doesn't depend on the TURBO_ENGINE_IGNORE_DIRTY: '1',
// minimum-compilation-time threshold. TURBO_ENGINE_SNAPSHOT_MIN_ACTIVE_TIME_MILLIS: '0',
TURBO_ENGINE_IGNORE_DIRTY: '1', }
TURBO_ENGINE_SNAPSHOT_MIN_ACTIVE_TIME_MILLIS: '0',
}
function cachePath() {
return path.join(next.testDir, '.next', 'cache', 'turbopack')
}
async function getCacheSize(): Promise<number> { function cachePath() {
let entries return path.join(next.testDir, '.next', 'cache', 'turbopack')
try { }
entries = await fs.readdir(cachePath(), {
recursive: true,
withFileTypes: true,
})
} catch {
// Directory doesn't exist -> nothing was cached.
return 0
}
let totalSize = 0
for (const entry of entries) {
if (entry.isFile()) {
const filePath = path.join(entry.parentPath ?? entry.path, entry.name)
totalSize += (await fs.stat(filePath)).size
}
}
return totalSize
}
async function cleanBuildOutput() { async function getCacheSize(): Promise<number> {
await fs.rm(path.join(next.testDir, '.next'), { let entries
try {
entries = await fs.readdir(cachePath(), {
recursive: true, recursive: true,
force: true, withFileTypes: true,
}) })
} catch {
// Directory doesn't exist -> nothing was cached.
return 0
} }
let totalSize = 0
// The shared fixture's next.config.js sets the flag explicitly from for (const entry of entries) {
// `ENABLE_CACHING`; overwrite it so we exercise the *default* instead. if (entry.isFile()) {
async function setConfig(experimental: Record<string, unknown> = {}) { const filePath = path.join(entry.parentPath ?? entry.path, entry.name)
await next.patchFile( totalSize += (await fs.stat(filePath)).size
'next.config.js', }
`module.exports = ${JSON.stringify({ experimental }, null, 2)}`
)
} }
return totalSize
}
afterEach(async () => { async function cleanBuildOutput() {
await setConfig() await fs.rm(path.join(next.testDir, '.next'), {
recursive: true,
force: true,
}) })
}
it('writes the cache by default (no config, local environment)', async () => { // The shared fixture's next.config.js sets the flag explicitly from
await cleanBuildOutput() // `ENABLE_CACHING`; overwrite it so we exercise the *default* instead.
await setConfig() async function setConfig(experimental: Record<string, unknown> = {}) {
await next.patchFile(
'next.config.js',
`module.exports = ${JSON.stringify({ experimental }, null, 2)}`
)
}
const { exitCode } = await next.build({ env: NON_CI_ENV }) afterEach(async () => {
expect(exitCode).toBe(0) await setConfig()
})
expect(await getCacheSize()).toBeGreaterThan(0) it('writes the cache by default (no config, local environment)', async () => {
}) await cleanBuildOutput()
await setConfig()
it('writes nothing when turbopackFileSystemCacheForBuild is false', async () => { const { exitCode } = await next.build({ env: NON_CI_ENV })
await cleanBuildOutput() expect(exitCode).toBe(0)
await setConfig({ turbopackFileSystemCacheForBuild: false })
const { exitCode } = await next.build({ env: NON_CI_ENV }) expect(await getCacheSize()).toBeGreaterThan(0)
expect(exitCode).toBe(0) })
expect(await getCacheSize()).toBe(0) it('writes nothing when turbopackFileSystemCacheForBuild is false', async () => {
}) await cleanBuildOutput()
await setConfig({ turbopackFileSystemCacheForBuild: false })
it('writes the cache by default in CI', async () => { const { exitCode } = await next.build({ env: NON_CI_ENV })
await cleanBuildOutput() expect(exitCode).toBe(0)
await setConfig()
const { exitCode } = await next.build({ expect(await getCacheSize()).toBe(0)
// Force a generic CI environment. })
env: { ...NON_CI_ENV, CI: '1' },
}) it('writes the cache by default in CI', async () => {
expect(exitCode).toBe(0) await cleanBuildOutput()
await setConfig()
expect(await getCacheSize()).toBeGreaterThan(0) const { exitCode } = await next.build({
// Force a generic CI environment.
env: { ...NON_CI_ENV, CI: '1' },
}) })
} expect(exitCode).toBe(0)
)
expect(await getCacheSize()).toBeGreaterThan(0)
})
})
import { nextTestSetup, isNextDev } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
import { retry, waitFor } from 'next-test-utils' import { retry, waitFor } from 'next-test-utils'
// Eviction requires the dev server (HMR) and persistent caching (Turbopack). // Eviction requires the dev server (HMR) and persistent caching (Turbopack).
// Skip entirely in prod/start mode. // Skip entirely in prod/start mode.
;(isNextDev ? describe : describe.skip)('evict-after-snapshot', () => { // TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely mutates files in the isolated local fixture after setup.
// @force-gate !deploy
// @force-gate dev
describe('evict-after-snapshot', () => {
const envVars = [ const envVars = [
'ENABLE_CACHING=1', 'ENABLE_CACHING=1',
'TURBO_ENGINE_IGNORE_DIRTY=1', 'TURBO_ENGINE_IGNORE_DIRTY=1',
...@@ -14,9 +18,8 @@ import { retry, waitFor } from 'next-test-utils' ...@@ -14,9 +18,8 @@ import { retry, waitFor } from 'next-test-utils'
'ENABLE_EVICTION=1', 'ENABLE_EVICTION=1',
].join(' ') ].join(' ')
const { skipped, next } = nextTestSetup({ const { next } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
packageJson: { packageJson: {
scripts: { scripts: {
dev: `${envVars} next dev`, dev: `${envVars} next dev`,
...@@ -26,10 +29,6 @@ import { retry, waitFor } from 'next-test-utils' ...@@ -26,10 +29,6 @@ import { retry, waitFor } from 'next-test-utils'
startCommand: 'npm run dev', startCommand: 'npm run dev',
}) })
if (skipped) {
return
}
async function waitForSnapshotAndEviction() { async function waitForSnapshotAndEviction() {
// The idle timeout is 1s, give extra time for snapshot + eviction to complete // The idle timeout is 1s, give extra time for snapshot + eviction to complete
await waitFor(5000) await waitFor(5000)
......
...@@ -28,6 +28,9 @@ async function getDirectorySize(dirPath: string): Promise<number> { ...@@ -28,6 +28,9 @@ async function getDirectorySize(dirPath: string): Promise<number> {
} }
for (const cacheEnabled of [false, true]) { for (const cacheEnabled of [false, true]) {
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely mutates files in the isolated local fixture after setup.
// @force-gate !deploy
describe(`filesystem-caching with cache ${cacheEnabled ? 'enabled' : 'disabled'}`, () => { describe(`filesystem-caching with cache ${cacheEnabled ? 'enabled' : 'disabled'}`, () => {
beforeAll(() => { beforeAll(() => {
process.env.NEXT_PUBLIC_ENV_VAR = 'hello world' process.env.NEXT_PUBLIC_ENV_VAR = 'hello world'
...@@ -47,9 +50,8 @@ for (const cacheEnabled of [false, true]) { ...@@ -47,9 +50,8 @@ for (const cacheEnabled of [false, true]) {
`TURBO_ENGINE_SNAPSHOT_MIN_ACTIVE_TIME_MILLIS=0`, `TURBO_ENGINE_SNAPSHOT_MIN_ACTIVE_TIME_MILLIS=0`,
].join(' ') ].join(' ')
const { skipped, next, isTurbopack } = nextTestSetup({ const { next, isTurbopack } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true,
packageJson: { packageJson: {
packageManager: 'npm@10.9.2', packageManager: 'npm@10.9.2',
scripts: { scripts: {
...@@ -65,10 +67,6 @@ for (const cacheEnabled of [false, true]) { ...@@ -65,10 +67,6 @@ for (const cacheEnabled of [false, true]) {
startCommand: isNextDev ? 'npm run dev' : 'npm run start', startCommand: isNextDev ? 'npm run dev' : 'npm run start',
}) })
if (skipped) {
return
}
beforeAll(() => { beforeAll(() => {
// We can skip the dev watch delay since this is not an HMR test // We can skip the dev watch delay since this is not an HMR test
;(next as any).handleDevWatchDelayBeforeChange = () => {} ;(next as any).handleDevWatchDelayBeforeChange = () => {}
......
...@@ -25,103 +25,100 @@ type TaskStats = Record<string, TaskFunctionStatistics> ...@@ -25,103 +25,100 @@ type TaskStats = Record<string, TaskFunctionStatistics>
const STATS_RELATIVE_PATH = '.next/warm-restart-task-stats.json' const STATS_RELATIVE_PATH = '.next/warm-restart-task-stats.json'
;(process.env.IS_TURBOPACK_TEST ? describe : describe.skip)( // TODO(deploy-test-completion): Re-enable this suite in deploy mode.
'warm-restart task statistics', // It likely inspects local build artifacts that deploy tests do not expose.
() => { // @force-gate !deploy
const env = [ // @force-gate turbopack
'ENABLE_CACHING=1', describe('warm-restart task statistics', () => {
'TURBO_ENGINE_IGNORE_DIRTY=1', const env = [
'TURBO_ENGINE_SNAPSHOT_IDLE_TIMEOUT_MILLIS=1000', 'ENABLE_CACHING=1',
// Persist even tiny snapshots so the test doesn't depend on the 'TURBO_ENGINE_IGNORE_DIRTY=1',
// minimum-compilation-time threshold. 'TURBO_ENGINE_SNAPSHOT_IDLE_TIMEOUT_MILLIS=1000',
'TURBO_ENGINE_SNAPSHOT_MIN_ACTIVE_TIME_MILLIS=0', // Persist even tiny snapshots so the test doesn't depend on the
`NEXT_TURBOPACK_TASK_STATISTICS=${STATS_RELATIVE_PATH}`, // minimum-compilation-time threshold.
// The task-statistics file is written by an `on_exit` handler in the 'TURBO_ENGINE_SNAPSHOT_MIN_ACTIVE_TIME_MILLIS=0',
// napi binding. In dev that handler only runs if the child process `NEXT_TURBOPACK_TASK_STATISTICS=${STATS_RELATIVE_PATH}`,
// gets a chance to clean up (i.e. SIGTERM, not SIGKILL). The parent // The task-statistics file is written by an `on_exit` handler in the
// `next dev` process gives the child 100ms by default before // napi binding. In dev that handler only runs if the child process
// escalating to SIGKILL — bump that so the on-exit handler can flush. // gets a chance to clean up (i.e. SIGTERM, not SIGKILL). The parent
'NEXT_EXIT_TIMEOUT_MS=30000', // `next dev` process gives the child 100ms by default before
].join(' ') // escalating to SIGKILL — bump that so the on-exit handler can flush.
'NEXT_EXIT_TIMEOUT_MS=30000',
].join(' ')
const { skipped, next } = nextTestSetup({ const { next } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true, packageJson: {
packageJson: { packageManager: 'npm@10.9.2',
packageManager: 'npm@10.9.2', scripts: {
scripts: { build: `${env} next build`,
build: `${env} next build`, dev: `${env} next dev`,
dev: `${env} next dev`, start: 'next start',
start: 'next start',
},
}, },
installCommand: 'npm i', },
buildCommand: 'npm run build', installCommand: 'npm i',
startCommand: isNextDev ? 'npm run dev' : 'npm run start', buildCommand: 'npm run build',
}) startCommand: isNextDev ? 'npm run dev' : 'npm run start',
})
if (skipped) { beforeAll(() => {
return // No file edits in this test — skip HMR debounce.
} ;(next as any).handleDevWatchDelayBeforeChange = () => {}
;(next as any).handleDevWatchDelayAfterChange = () => {}
beforeAll(() => { })
// No file edits in this test — skip HMR debounce.
;(next as any).handleDevWatchDelayBeforeChange = () => {}
;(next as any).handleDevWatchDelayAfterChange = () => {}
})
async function stop() { async function stop() {
if (isNextDev) { if (isNextDev) {
// Persistent cache snapshot is on a 1s idle timer; give it room. // Persistent cache snapshot is on a 1s idle timer; give it room.
await waitFor(3000) await waitFor(3000)
// SIGTERM (not the harness default SIGKILL) so the dev server gets // SIGTERM (not the harness default SIGKILL) so the dev server gets
// to run its cleanup, which is what flushes the task-stats file. // to run its cleanup, which is what flushes the task-stats file.
await next.stop('SIGTERM') await next.stop('SIGTERM')
} else { } else {
await next.stop() await next.stop()
}
} }
}
async function readMissedTaskNames(): Promise<string[]> { async function readMissedTaskNames(): Promise<string[]> {
const absPath = path.join(next.testDir, STATS_RELATIVE_PATH) const absPath = path.join(next.testDir, STATS_RELATIVE_PATH)
const raw = await fs.readFile(absPath, 'utf8') const raw = await fs.readFile(absPath, 'utf8')
const stats = JSON.parse(raw) as TaskStats const stats = JSON.parse(raw) as TaskStats
const misses: string[] = [] const misses: string[] = []
for (const [name, s] of Object.entries(stats)) { for (const [name, s] of Object.entries(stats)) {
if (s.cache_miss > 0) misses.push(name) if (s.cache_miss > 0) misses.push(name)
}
// Turbopack sorts on the Rust side, but sort again here to be robust
// against the JSON parser's object iteration order.
misses.sort()
return misses
} }
// Turbopack sorts on the Rust side, but sort again here to be robust
// against the JSON parser's object iteration order.
misses.sort()
return misses
}
if (isNextDev) { if (isNextDev) {
it('snapshot of tasks with cache misses on warm dev restart', async () => { it('snapshot of tasks with cache misses on warm dev restart', async () => {
// Cycle 1: the harness already auto-started; perform a request so the // Cycle 1: the harness already auto-started; perform a request so the
// SSR/Node chunk work runs and gets persisted on shutdown. // SSR/Node chunk work runs and gets persisted on shutdown.
async function runDevCycle() { async function runDevCycle() {
const browser = await next.browser('/') const browser = await next.browser('/')
// Wait for actual rendered content before declaring "ready". // Wait for actual rendered content before declaring "ready".
await browser.elementByCss('p') await browser.elementByCss('p')
// Settle: the dev server keeps doing background work after first // Settle: the dev server keeps doing background work after first
// paint (HMR socket handshake, tail compilation). A fixed sleep // paint (HMR socket handshake, tail compilation). A fixed sleep
// is the least-bad option here since next.js doesn't expose // is the least-bad option here since next.js doesn't expose
// turbopack's internal idle signal. If this proves flaky in CI, // turbopack's internal idle signal. If this proves flaky in CI,
// raise the value. // raise the value.
await waitFor(2000) await waitFor(2000)
await browser.close() await browser.close()
} }
await runDevCycle() await runDevCycle()
await stop() await stop()
// Cycle 2: warm. // Cycle 2: warm.
await next.start() await next.start()
await runDevCycle() await runDevCycle()
await stop() await stop()
const missed = await readMissedTaskNames() const missed = await readMissedTaskNames()
expect(missed).toMatchInlineSnapshot(` expect(missed).toMatchInlineSnapshot(`
[ [
"<turbopack_browser::ecmascript::list::content::EcmascriptDevChunkListContent as dyn turbopack_core::version::VersionedContent>::update", "<turbopack_browser::ecmascript::list::content::EcmascriptDevChunkListContent as dyn turbopack_core::version::VersionedContent>::update",
"next_api::project::Project::hmr_update", "next_api::project::Project::hmr_update",
...@@ -131,22 +128,21 @@ const STATS_RELATIVE_PATH = '.next/warm-restart-task-stats.json' ...@@ -131,22 +128,21 @@ const STATS_RELATIVE_PATH = '.next/warm-restart-task-stats.json'
"turbopack_core::version::VersionState::get", "turbopack_core::version::VersionState::get",
] ]
`) `)
}, 180_000) }, 180_000)
} else { } else {
it('snapshot of tasks with cache misses on warm build', async () => { it('snapshot of tasks with cache misses on warm build', async () => {
// In start mode the harness auto-runs `next build` then `next start`. // In start mode the harness auto-runs `next build` then `next start`.
// The build is cycle 1. We stop the server (we don't care about it) // The build is cycle 1. We stop the server (we don't care about it)
// and run a second build manually for the warm measurement. // and run a second build manually for the warm measurement.
await stop() await stop()
const result = await (next as any).build() const result = await (next as any).build()
if (result.exitCode !== 0) { if (result.exitCode !== 0) {
throw new Error(`next build exited with ${result.exitCode}`) throw new Error(`next build exited with ${result.exitCode}`)
} }
const missed = await readMissedTaskNames() const missed = await readMissedTaskNames()
expect(missed).toMatchInlineSnapshot(`[]`) expect(missed).toMatchInlineSnapshot(`[]`)
}, 240_000) }, 240_000)
}
} }
) })
...@@ -18,8 +18,11 @@ const CASES = [ ...@@ -18,8 +18,11 @@ const CASES = [
describe('persistent-caching-migration', () => { describe('persistent-caching-migration', () => {
for (const [option, error] of CASES) { for (const [option, error] of CASES) {
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely expects a local build failure instead of a successful deployment.
// @force-gate !deploy
describe(option, () => { describe(option, () => {
const { skipped, next, isTurbopack, isNextStart } = nextTestSetup({ const { next, isTurbopack, isNextStart } = nextTestSetup({
files: { files: {
'next.config.js': `module.exports = { 'next.config.js': `module.exports = {
experimental: { experimental: {
...@@ -27,14 +30,9 @@ describe('persistent-caching-migration', () => { ...@@ -27,14 +30,9 @@ describe('persistent-caching-migration', () => {
}, },
}`, }`,
}, },
skipDeployment: true,
skipStart: true, skipStart: true,
}) })
if (skipped) {
return
}
if (!isTurbopack) { if (!isTurbopack) {
it.skip('only for turbopack', () => {}) it.skip('only for turbopack', () => {})
return return
......
...@@ -3,11 +3,12 @@ import { retry } from 'next-test-utils' ...@@ -3,11 +3,12 @@ import { retry } from 'next-test-utils'
import fs from 'fs' import fs from 'fs'
import { join } from 'path' import { join } from 'path'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// Assertions don't apply to deploy mode (output differs vs. local Next.js server).
// @force-gate !deploy
describe('Fallback path encoding', () => { describe('Fallback path encoding', () => {
const { next, isNextDev, isNextStart } = nextTestSetup({ const { next, isNextDev, isNextStart } = nextTestSetup({
files: __dirname, files: __dirname,
// Assertions don't apply to deploy mode (output differs vs. local Next.js server).
skipDeployment: true,
}) })
const urlPaths = [ const urlPaths = [
......
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// Vercel deployment fails to build/deploy this fixture in CI; skip in deploy mode.
// @force-gate !deploy
describe('ssg-dynamic-routes-404-page', () => { describe('ssg-dynamic-routes-404-page', () => {
const { next } = nextTestSetup({ const { next } = nextTestSetup({
files: __dirname, files: __dirname,
...@@ -7,8 +10,6 @@ describe('ssg-dynamic-routes-404-page', () => { ...@@ -7,8 +10,6 @@ describe('ssg-dynamic-routes-404-page', () => {
react: '19.3.0-canary-fef12a01-20260413', react: '19.3.0-canary-fef12a01-20260413',
'react-dom': '19.3.0-canary-fef12a01-20260413', 'react-dom': '19.3.0-canary-fef12a01-20260413',
}, },
// Vercel deployment fails to build/deploy this fixture in CI; skip in deploy mode.
skipDeployment: true,
}) })
it('should respond to a not existing page with 404', async () => { it('should respond to a not existing page with 404', async () => {
......
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