Unverified Commit 0f3a2bef authored by Jamiboy Mohammad's avatar Jamiboy Mohammad Committed by GitHub

test: migrate legacy deployment exclusion callers (#98473)

## Summary

Migrate the shared cache-components error tests and two additional
legacy deployment exclusions from `skipDeployment`/`skipped` to test
gates, so these callers can land on canary before the API is removed.

Place the cache-error gate on the existing named `describe` boundary in
each of the 12 `.test.ts` entry files. Jest transforms gate pragmas in
test files; a gate in the shared utility would be inert. The helper
continues registering the same tests inside those entry-level suites,
preserving their names and snapshots. These tests inspect local
prerender builds and cannot run against a deployment.

The other two callers cover segment-cache fixture mutation and
production output-file tracing. This is a standalone preparatory
migration, not the removal of the legacy API itself.

## Verification

- Rebased onto canary at `ccef3db5`; the stable patch ID matches the
original migration exactly.
- On the rebased tree, all 77 gate infrastructure unit tests passed.
- Deploy-mode Jest collection of all 12 cache-error entry files: 236
skipped, zero executed, and no deployment started.
- Prettier, ESLint, and diff whitespace checks passed.
- Full bootstrap attempted but blocked by missing package-level
dependencies (`microbundle`) in the temporary worktree; no full
dev/start integration run is claimed.

<!-- NEXT_JS_LLM -->
parent 72858d71
...@@ -3,4 +3,8 @@ import { registerErrorAttributionTests } from './error-attribution.util' ...@@ -3,4 +3,8 @@ import { registerErrorAttributionTests } from './error-attribution.util'
process.env.__NEXT_PARTIAL_PREFETCHING = 'true' process.env.__NEXT_PARTIAL_PREFETCHING = 'true'
runCacheComponentsErrorsTests(registerErrorAttributionTests) // These tests run local builds to inspect prerender error diagnostics.
// @force-gate !deploy
describe('Cache Components Errors', () => {
runCacheComponentsErrorsTests(registerErrorAttributionTests)
})
import { runCacheComponentsErrorsTests } from './shared.util' import { runCacheComponentsErrorsTests } from './shared.util'
import { registerErrorAttributionTests } from './error-attribution.util' import { registerErrorAttributionTests } from './error-attribution.util'
runCacheComponentsErrorsTests(registerErrorAttributionTests) // These tests run local builds to inspect prerender error diagnostics.
// @force-gate !deploy
describe('Cache Components Errors', () => {
runCacheComponentsErrorsTests(registerErrorAttributionTests)
})
...@@ -3,4 +3,8 @@ import { registerMetadataAndViewportTests } from './metadata-and-viewport.util' ...@@ -3,4 +3,8 @@ import { registerMetadataAndViewportTests } from './metadata-and-viewport.util'
process.env.__NEXT_PARTIAL_PREFETCHING = 'true' process.env.__NEXT_PARTIAL_PREFETCHING = 'true'
runCacheComponentsErrorsTests(registerMetadataAndViewportTests) // These tests run local builds to inspect prerender error diagnostics.
// @force-gate !deploy
describe('Cache Components Errors', () => {
runCacheComponentsErrorsTests(registerMetadataAndViewportTests)
})
import { runCacheComponentsErrorsTests } from './shared.util' import { runCacheComponentsErrorsTests } from './shared.util'
import { registerMetadataAndViewportTests } from './metadata-and-viewport.util' import { registerMetadataAndViewportTests } from './metadata-and-viewport.util'
runCacheComponentsErrorsTests(registerMetadataAndViewportTests) // These tests run local builds to inspect prerender error diagnostics.
// @force-gate !deploy
describe('Cache Components Errors', () => {
runCacheComponentsErrorsTests(registerMetadataAndViewportTests)
})
...@@ -14,73 +14,50 @@ export interface CacheComponentsErrorsContext { ...@@ -14,73 +14,50 @@ export interface CacheComponentsErrorsContext {
// into one `*.test.ts` entry file per group of sections (each with a // into one `*.test.ts` entry file per group of sections (each with a
// `.partial-prefetching` variant), all sharing this wrapper. Each entry // `.partial-prefetching` variant), all sharing this wrapper. Each entry
// boots its own server (and, in `next start` mode, runs its own builds). // boots its own server (and, in `next start` mode, runs its own builds).
// Snapshots can be updated with the sibling update-snapshots.sh script. // Each entry owns its gated describe because pragmas are only transformed in
// test files. Snapshots can be updated with the sibling update-snapshots.sh script.
export function runCacheComponentsErrorsTests( export function runCacheComponentsErrorsTests(
registerTests: (ctx: CacheComponentsErrorsContext) => void registerTests: (ctx: CacheComponentsErrorsContext) => void
) { ) {
describe('Cache Components Errors', () => { const { next, isTurbopack, isNextStart, isRspack } = nextTestSetup({
const { next, isTurbopack, isNextStart, isRspack, skipped } = nextTestSetup( files: __dirname + '/fixtures/default',
{ skipStart: !isNextDev,
files: __dirname + '/fixtures/default', })
skipStart: !isNextDev,
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// No deploy-specific incompatibility is documented.
skipDeployment: true,
}
)
if (skipped) return
afterEach(async () => {
if (isNextStart) {
await next.stop()
}
})
const testCases: { isDebugPrerender: boolean; name: string }[] = []
if (isNextDev) { afterEach(async () => {
testCases.push({ isDebugPrerender: false, name: 'Dev' }) if (isNextStart) {
} else { await next.stop()
const prerenderMode = process.env.NEXT_TEST_DEBUG_PRERENDER
// The snapshots can't be created for both modes at the same time because of
// an issue in the typescript plugin for prettier. Defining
// NEXT_TEST_DEBUG_PRERENDER allows us to run them sequentially, when we
// need to update the snapshots.
if (!prerenderMode || prerenderMode === 'true') {
testCases.push({
isDebugPrerender: true,
name: 'Build With --prerender-debug',
})
}
if (!prerenderMode || prerenderMode === 'false') {
testCases.push({
isDebugPrerender: false,
name: 'Build Without --prerender-debug',
})
}
} }
})
describe.each(testCases)('$name', ({ isDebugPrerender }) => { const testCases: { isDebugPrerender: boolean; name: string }[] = []
beforeAll(async () => {
if (isNextStart) {
const args = ['--experimental-build-mode', 'compile']
if (isDebugPrerender) {
args.push('--debug-prerender')
}
await next.build({ args }) if (isNextDev) {
} testCases.push({ isDebugPrerender: false, name: 'Dev' })
} else {
const prerenderMode = process.env.NEXT_TEST_DEBUG_PRERENDER
// The snapshots can't be created for both modes at the same time because of
// an issue in the typescript plugin for prettier. Defining
// NEXT_TEST_DEBUG_PRERENDER allows us to run them sequentially, when we
// need to update the snapshots.
if (!prerenderMode || prerenderMode === 'true') {
testCases.push({
isDebugPrerender: true,
name: 'Build With --prerender-debug',
})
}
if (!prerenderMode || prerenderMode === 'false') {
testCases.push({
isDebugPrerender: false,
name: 'Build Without --prerender-debug',
}) })
}
}
const prerender = async (pathname: string) => { describe.each(testCases)('$name', ({ isDebugPrerender }) => {
const args = [ beforeAll(async () => {
'--experimental-build-mode', if (isNextStart) {
'generate', const args = ['--experimental-build-mode', 'compile']
'--debug-build-paths',
`app${pathname}/page.tsx`,
]
if (isDebugPrerender) { if (isDebugPrerender) {
args.push('--debug-prerender') args.push('--debug-prerender')
...@@ -88,15 +65,30 @@ export function runCacheComponentsErrorsTests( ...@@ -88,15 +65,30 @@ export function runCacheComponentsErrorsTests(
await next.build({ args }) await next.build({ args })
} }
})
const prerender = async (pathname: string) => {
const args = [
'--experimental-build-mode',
'generate',
'--debug-build-paths',
`app${pathname}/page.tsx`,
]
if (isDebugPrerender) {
args.push('--debug-prerender')
}
registerTests({ await next.build({ args })
next, }
isTurbopack,
isRspack, registerTests({
isNextStart, next,
isDebugPrerender, isTurbopack,
prerender, isRspack,
}) isNextStart,
isDebugPrerender,
prerender,
}) })
}) })
} }
...@@ -7,7 +7,11 @@ process.env.__NEXT_PARTIAL_PREFETCHING = 'true' ...@@ -7,7 +7,11 @@ process.env.__NEXT_PARTIAL_PREFETCHING = 'true'
// Registers two section groups in one entry: dynamic-root-and-boundary is too // Registers two section groups in one entry: dynamic-root-and-boundary is too
// small to justify its own CI test file (per-file server boot and, in start // small to justify its own CI test file (per-file server boot and, in start
// mode, build costs). // mode, build costs).
runCacheComponentsErrorsTests((ctx) => { // These tests run local builds to inspect prerender error diagnostics.
registerDynamicRootAndBoundaryTests(ctx) // @force-gate !deploy
registerSyncDynamicTests(ctx) describe('Cache Components Errors', () => {
runCacheComponentsErrorsTests((ctx) => {
registerDynamicRootAndBoundaryTests(ctx)
registerSyncDynamicTests(ctx)
})
}) })
...@@ -5,7 +5,11 @@ import { registerSyncDynamicTests } from './sync-dynamic.util' ...@@ -5,7 +5,11 @@ import { registerSyncDynamicTests } from './sync-dynamic.util'
// Registers two section groups in one entry: dynamic-root-and-boundary is too // Registers two section groups in one entry: dynamic-root-and-boundary is too
// small to justify its own CI test file (per-file server boot and, in start // small to justify its own CI test file (per-file server boot and, in start
// mode, build costs). // mode, build costs).
runCacheComponentsErrorsTests((ctx) => { // These tests run local builds to inspect prerender error diagnostics.
registerDynamicRootAndBoundaryTests(ctx) // @force-gate !deploy
registerSyncDynamicTests(ctx) describe('Cache Components Errors', () => {
runCacheComponentsErrorsTests((ctx) => {
registerDynamicRootAndBoundaryTests(ctx)
registerSyncDynamicTests(ctx)
})
}) })
...@@ -3,4 +3,8 @@ import { registerSyncIoNodeCryptoTests } from './sync-io-node-crypto.util' ...@@ -3,4 +3,8 @@ import { registerSyncIoNodeCryptoTests } from './sync-io-node-crypto.util'
process.env.__NEXT_PARTIAL_PREFETCHING = 'true' process.env.__NEXT_PARTIAL_PREFETCHING = 'true'
runCacheComponentsErrorsTests(registerSyncIoNodeCryptoTests) // These tests run local builds to inspect prerender error diagnostics.
// @force-gate !deploy
describe('Cache Components Errors', () => {
runCacheComponentsErrorsTests(registerSyncIoNodeCryptoTests)
})
import { runCacheComponentsErrorsTests } from './shared.util' import { runCacheComponentsErrorsTests } from './shared.util'
import { registerSyncIoNodeCryptoTests } from './sync-io-node-crypto.util' import { registerSyncIoNodeCryptoTests } from './sync-io-node-crypto.util'
runCacheComponentsErrorsTests(registerSyncIoNodeCryptoTests) // These tests run local builds to inspect prerender error diagnostics.
// @force-gate !deploy
describe('Cache Components Errors', () => {
runCacheComponentsErrorsTests(registerSyncIoNodeCryptoTests)
})
...@@ -3,4 +3,8 @@ import { registerSyncIoTimeAndRandomTests } from './sync-io-time-and-random.util ...@@ -3,4 +3,8 @@ import { registerSyncIoTimeAndRandomTests } from './sync-io-time-and-random.util
process.env.__NEXT_PARTIAL_PREFETCHING = 'true' process.env.__NEXT_PARTIAL_PREFETCHING = 'true'
runCacheComponentsErrorsTests(registerSyncIoTimeAndRandomTests) // These tests run local builds to inspect prerender error diagnostics.
// @force-gate !deploy
describe('Cache Components Errors', () => {
runCacheComponentsErrorsTests(registerSyncIoTimeAndRandomTests)
})
import { runCacheComponentsErrorsTests } from './shared.util' import { runCacheComponentsErrorsTests } from './shared.util'
import { registerSyncIoTimeAndRandomTests } from './sync-io-time-and-random.util' import { registerSyncIoTimeAndRandomTests } from './sync-io-time-and-random.util'
runCacheComponentsErrorsTests(registerSyncIoTimeAndRandomTests) // These tests run local builds to inspect prerender error diagnostics.
// @force-gate !deploy
describe('Cache Components Errors', () => {
runCacheComponentsErrorsTests(registerSyncIoTimeAndRandomTests)
})
...@@ -7,7 +7,11 @@ process.env.__NEXT_PARTIAL_PREFETCHING = 'true' ...@@ -7,7 +7,11 @@ process.env.__NEXT_PARTIAL_PREFETCHING = 'true'
// Registers two section groups in one entry: use-cache-private is too small // Registers two section groups in one entry: use-cache-private is too small
// to justify its own CI test file (per-file server boot and, in start mode, // to justify its own CI test file (per-file server boot and, in start mode,
// build costs). // build costs).
runCacheComponentsErrorsTests((ctx) => { // These tests run local builds to inspect prerender error diagnostics.
registerUseCacheTests(ctx) // @force-gate !deploy
registerUseCachePrivateTests(ctx) describe('Cache Components Errors', () => {
runCacheComponentsErrorsTests((ctx) => {
registerUseCacheTests(ctx)
registerUseCachePrivateTests(ctx)
})
}) })
...@@ -5,7 +5,11 @@ import { registerUseCachePrivateTests } from './use-cache-private.util' ...@@ -5,7 +5,11 @@ import { registerUseCachePrivateTests } from './use-cache-private.util'
// Registers two section groups in one entry: use-cache-private is too small // Registers two section groups in one entry: use-cache-private is too small
// to justify its own CI test file (per-file server boot and, in start mode, // to justify its own CI test file (per-file server boot and, in start mode,
// build costs). // build costs).
runCacheComponentsErrorsTests((ctx) => { // These tests run local builds to inspect prerender error diagnostics.
registerUseCacheTests(ctx) // @force-gate !deploy
registerUseCachePrivateTests(ctx) describe('Cache Components Errors', () => {
runCacheComponentsErrorsTests((ctx) => {
registerUseCacheTests(ctx)
registerUseCachePrivateTests(ctx)
})
}) })
...@@ -17,12 +17,13 @@ const REPRODUCE_MISSING_RUNTIME_SHELL_FOLLOW_UP = ...@@ -17,12 +17,13 @@ const REPRODUCE_MISSING_RUNTIME_SHELL_FOLLOW_UP =
const REPRODUCE_STATIC_PAGE_UPGRADE_BUG = const REPRODUCE_STATIC_PAGE_UPGRADE_BUG =
!!process.env.REPRODUCE_STATIC_PAGE_UPGRADE_BUG || false !!process.env.REPRODUCE_STATIC_PAGE_UPGRADE_BUG || false
// The fixture rewrites value.json during requests; deployments do not provide
// a writable, shared application filesystem.
// @force-gate !deploy
describe('App Shell revalidation', () => { describe('App Shell revalidation', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname, files: __dirname,
skipDeployment: true, // modifies files at runtime
}) })
if (skipped) return
if (isNextDev) { if (isNextDev) {
it('is skipped', () => {}) it('is skipped', () => {})
return return
......
import path from 'path' import path from 'path'
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
// Runs a local build and reads its page.js.nft.json file to verify traced files.
// Deployment mode does not expose those local build artifacts.
// @force-gate !deploy
describe('outputFileTracingIncludes read glob', () => { describe('outputFileTracingIncludes read glob', () => {
const { next, skipped } = nextTestSetup({ const { next } = nextTestSetup({
files: __dirname, files: __dirname,
dependencies: { dependencies: {
'lightningcss-wasm': '1.28.2', 'lightningcss-wasm': '1.28.2',
}, },
skipStart: true, skipStart: true,
skipDeployment: true,
}) })
if (skipped) return
it('traces a file from the monorepo node_modules directory', async () => { it('traces a file from the monorepo node_modules directory', async () => {
const wasmPath = require.resolve( const wasmPath = require.resolve(
......
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