Unverified Commit f19ae744 authored by Jamiboy Mohammad's avatar Jamiboy Mohammad Committed by GitHub

test: migrate independent App Router deploy exclusions to force gates (#99431)

## Summary

Replace the App Router `skipDeployment` options still present in the
base with equivalent static `@force-gate` directives. Existing `skipped`
bindings and checks, manual mode guards, fixture configuration,
assertions, and hooks are preserved. Tests whose deployment exclusions
were already removed on canary are left unchanged.

The two adapter exceptions remain `!deploy || adapter`. The existing
Turbopack restriction on the missing-root-layout suite is retained. The
shared instant-validation suite wrapper moves to its five test entry
points so the gate transformer can apply `!deploy`; the
partial-prefetching variants inherit these gates.

This is the independent portion of #98155, after #98160 in the
canary-based stack containing #98158. The viewport known-limitation
suite remains in #98155 because its lazy configuration predicate needs
#98430.

## Verification

- Compared the complete syntax trees of all 60 previously touched files
against the base: only deployment-option removal, directly associated
adapter bindings, and required gate-wrapper placement differ. All 120
references to `skipped` are preserved; 27 files are now byte-for-byte
unchanged from the base.
- Registration-only comparisons cover 37 entry points in dev, start, and
deploy with Webpack and Turbopack, including deploy with the adapter
disabled. Fixture eligibility is unchanged. The already-enabled
opaque-origin sibling is no longer suppressed by the legacy `it.only`
placeholder.
- TypeScript, Prettier, and ESLint passed. Registration probes disable
bodies and hooks and use default resolved values for existing lazy
predicates; they do not validate remote deployment builds or browser
behavior.
- Rebased the five open migration layers onto canary; 16 superseded
files are unchanged from canary, with all other layer files preserved
exactly. All 15 commits retain their authorship and signatures.
- The 79 gate unit tests passed. Full bootstrap attempted: 14/15 tasks
passed; the isolated worktree lacks the bundle-analyzer app
dependencies. Browser and remote deployment execution remains for CI.

<!-- NEXT_JS_LLM -->

---------
Co-authored-by: 's avatarJosh Story <gnoff@storyposted.com>
parent 5ccf52d1
......@@ -2,10 +2,10 @@ import { nextTestSetup } from 'e2e-utils'
import { check } from 'next-test-utils'
import { join } from 'path'
// @force-gate !deploy
describe('app-dir action disallowed origins', () => {
const { next, skipped } = nextTestSetup({
files: join(__dirname, 'unsafe-origins'),
skipDeployment: true,
dependencies: {
'server-only': 'latest',
},
......
......@@ -2,6 +2,8 @@ import { nextTestSetup } from 'e2e-utils'
import { retry } from 'next-test-utils'
import { join } from 'path'
// Preserve the sibling suite's deploy exclusion previously imposed by skipDeployment's it.only.
// @force-gate !deploy
describe('app-dir action allowed from opaque origins', () => {
const { next } = nextTestSetup({
files: join(__dirname, 'opaque-origin'),
......@@ -23,10 +25,10 @@ describe('app-dir action allowed from opaque origins', () => {
})
})
// @force-gate !deploy
describe('app-dir action disallowed from opaque origins', () => {
const { isNextDev, next, skipped } = nextTestSetup({
files: join(__dirname, 'opaque-origin'),
skipDeployment: true,
env: {
NEXT_TEST_ALLOW_OPAQUE_ORIGIN: '',
},
......
import { nextTestSetup } from 'e2e-utils'
import { retry } from '../../../lib/next-test-utils'
// No access to runtime logs when deployed.
// @force-gate !deploy
describe('actions-unused-args', () => {
const { next, skipped } = nextTestSetup({
files: __dirname,
// No access to runtime logs when deployed.
skipDeployment: true,
})
if (skipped) {
......
......@@ -15,6 +15,7 @@ async function resolveStreamResponse(response: any, onData?: any) {
return result
}
// @force-gate !deploy
describe('app dir - external dependency', () => {
const { next, skipped } = nextTestSetup({
files: __dirname,
......@@ -32,7 +33,6 @@ describe('app dir - external dependency', () => {
installCommand: 'pnpm i',
startCommand: (global as any).isNextDev ? 'pnpm dev' : 'pnpm start',
buildCommand: 'pnpm build',
skipDeployment: true,
})
if (skipped) {
......
......@@ -8,12 +8,12 @@ import { retry } from 'next-test-utils'
// Running `tsc --noEmit` verifies the generated root-params.d.ts is wired in
// and produces the expected types.
// @force-gate !deploy
describe.each([{ fixture: 'simple' }, { fixture: 'multiple-roots' }])(
'app-root-param-getters - typecheck ($fixture)',
({ fixture }) => {
const { next, skipped } = nextTestSetup({
files: join(__dirname, 'fixtures', fixture),
skipDeployment: true,
})
if (skipped) {
......
import { nextTestSetup } from 'e2e-utils'
import { getClientReferenceManifest } from 'next-test-utils'
// @force-gate !deploy
describe('client-reference-chunking', () => {
const { next } = nextTestSetup({
files: __dirname,
skipDeployment: true,
})
it('should use the same chunks for client references across routes', async () => {
......
......@@ -224,40 +224,37 @@ import stripAnsi from 'strip-ansi'
}
}
)
;(process.env.IS_TURBOPACK_TEST ? describe : describe.skip)(
'app-dir missing root layout',
() => {
const { next, isNextDev, skipped } = nextTestSetup({
files: {
app: new FileRef(path.join(__dirname, 'app')),
'next.config.js': new FileRef(path.join(__dirname, 'next.config.js')),
},
skipDeployment: true,
skipStart: true,
})
if (skipped) return
it('reports a compiler error without modifying the app', async () => {
if (isNextDev) {
await next.start()
const response = await next.fetch('/route')
expect(response.status).toBe(500)
await retry(async () => {
expect(stripAnsi(next.cliOutput)).toContain(
"route/page.js doesn't have a root layout. To fix this error, make sure every page has a root layout."
)
})
} else {
await expect(next.start()).rejects.toThrow('next build failed')
// @force-gate !deploy && turbopack
describe('app-dir missing root layout', () => {
const { next, isNextDev, skipped } = nextTestSetup({
files: {
app: new FileRef(path.join(__dirname, 'app')),
'next.config.js': new FileRef(path.join(__dirname, 'next.config.js')),
},
skipStart: true,
})
if (skipped) return
it('reports a compiler error without modifying the app', async () => {
if (isNextDev) {
await next.start()
const response = await next.fetch('/route')
expect(response.status).toBe(500)
await retry(async () => {
expect(stripAnsi(next.cliOutput)).toContain(
"route/page.js doesn't have a root layout. To fix this error, make sure every page has a root layout."
)
}
})
} else {
await expect(next.start()).rejects.toThrow('next build failed')
expect(stripAnsi(next.cliOutput)).toContain(
"route/page.js doesn't have a root layout. To fix this error, make sure every page has a root layout."
)
}
expect(await next.hasFile('app/layout.js')).toBe(false)
})
}
)
expect(await next.hasFile('app/layout.js')).toBe(false)
})
})
......@@ -9,11 +9,11 @@ async function expectContainOnce(next: any, search: string) {
})
}
// Runtime logs aren't available when deployed
// @force-gate !deploy
describe('dedupe-rsc-error-log', () => {
const { next } = nextTestSetup({
files: __dirname,
// Runtime logs aren't available when deployed
skipDeployment: true,
})
it('should only log RSC error once for nodejs runtime', async () => {
......
import { nextTestSetup } from 'e2e-utils'
// @force-gate !deploy
describe('empty-generate-static-params', () => {
const { next, isNextDev, isTurbopack, skipped } = nextTestSetup({
files: __dirname,
skipStart: true,
skipDeployment: true,
})
if (skipped) {
......
......@@ -2,10 +2,10 @@ import { nextTestSetup } from 'e2e-utils'
import { retry } from 'next-test-utils'
import stripAnsi from 'strip-ansi'
// @force-gate !deploy
describe('app-dir - errors', () => {
const { next, isNextDev, isNextStart, skipped } = nextTestSetup({
files: __dirname,
skipDeployment: true,
})
if (skipped) {
......
......@@ -14,11 +14,11 @@ import { waitForNoErrorToast } from '../../../lib/next-test-utils'
// For exhaustive coverage of explicit levels and per-segment overrides,
// see the sibling `instant-validation-level-{warning,manual-warning,error,
// manual-error}` fixtures.
// @force-gate !deploy
describe('instant validation - default level', () => {
const { next, skipped, isNextDev, isNextStart, isTurbopack } = nextTestSetup({
files: __dirname,
skipStart: true,
skipDeployment: true,
env: {
NEXT_TEST_LOG_VALIDATION: '1',
},
......
......@@ -6,11 +6,11 @@ import {
} from 'e2e-utils/instant-validation'
import { waitForNoErrorToast } from '../../../lib/next-test-utils'
// @force-gate !deploy
describe('instant validation - level error', () => {
const { next, skipped, isNextDev, isNextStart, isTurbopack } = nextTestSetup({
files: __dirname,
skipStart: true,
skipDeployment: true,
env: {
NEXT_TEST_LOG_VALIDATION: '1',
},
......
......@@ -6,11 +6,11 @@ import {
} from 'e2e-utils/instant-validation'
import { waitForNoErrorToast } from '../../../lib/next-test-utils'
// @force-gate !deploy
describe('instant validation - level manual-error', () => {
const { next, skipped, isNextDev, isNextStart, isTurbopack } = nextTestSetup({
files: __dirname,
skipStart: true,
skipDeployment: true,
env: {
NEXT_TEST_LOG_VALIDATION: '1',
},
......
......@@ -8,11 +8,11 @@ import {
import { getPrerenderOutput } from '../cache-components-errors/utils'
import { waitForNoErrorToast } from '../../../lib/next-test-utils'
// @force-gate !deploy
describe('instant validation - level manual-warning', () => {
const { next, skipped, isNextDev, isNextStart, isTurbopack } = nextTestSetup({
files: __dirname,
skipStart: true,
skipDeployment: true,
env: {
NEXT_TEST_LOG_VALIDATION: '1',
},
......
......@@ -6,11 +6,11 @@ import {
} from 'e2e-utils/instant-validation'
import { waitForNoErrorToast } from '../../../lib/next-test-utils'
// @force-gate !deploy
describe('instant validation - level warning', () => {
const { next, skipped, isNextDev, isNextStart, isTurbopack } = nextTestSetup({
files: __dirname,
skipStart: true,
skipDeployment: true,
env: {
NEXT_TEST_LOG_VALIDATION: '1',
},
......
import { runInstantValidationTests } from './harness.util'
import { registerClientTests } from './client.util'
runInstantValidationTests((ctx) => {
registerClientTests(ctx)
// @force-gate !deploy
describe('instant validation', () => {
runInstantValidationTests((ctx) => {
registerClientTests(ctx)
})
})
import { runInstantValidationTests } from './harness.util'
import { registerHeadAndReportingTests } from './head-and-reporting.util'
runInstantValidationTests((ctx) => {
registerHeadAndReportingTests(ctx)
// @force-gate !deploy
describe('instant validation', () => {
runInstantValidationTests((ctx) => {
registerHeadAndReportingTests(ctx)
})
})
......@@ -8,11 +8,11 @@ import {
} from 'e2e-utils/instant-validation'
import { retry, waitForNoErrorToast } from '../../../lib/next-test-utils'
// @force-gate !deploy
describe('instant validation - parallel slot configs', () => {
const { next, skipped, isNextDev, isNextStart, isTurbopack } = nextTestSetup({
files: __dirname,
skipStart: true,
skipDeployment: true,
env: {
NEXT_TEST_LOG_VALIDATION: '1',
},
......
......@@ -6,11 +6,11 @@ import {
import { retry, waitForRedbox } from '../../../lib/next-test-utils'
import { createRedboxSnapshot } from '../../../lib/add-redbox-matchers'
// @force-gate !deploy
describe('instant validation - server errors', () => {
const { next, skipped, isNextDev, isNextStart, isTurbopack } = nextTestSetup({
files: __dirname,
skipStart: true,
skipDeployment: true,
env: {
NEXT_TEST_LOG_VALIDATION: '1',
},
......
import { runInstantValidationTests } from './harness.util'
import { registerSlotsAndGroupsTests } from './slots-and-groups.util'
runInstantValidationTests((ctx) => {
registerSlotsAndGroupsTests(ctx)
// @force-gate !deploy
describe('instant validation', () => {
runInstantValidationTests((ctx) => {
registerSlotsAndGroupsTests(ctx)
})
})
import { runInstantValidationTests } from './harness.util'
import { registerSuspenseBoundariesTests } from './suspense-boundaries.util'
runInstantValidationTests((ctx) => {
registerSuspenseBoundariesTests(ctx)
// @force-gate !deploy
describe('instant validation', () => {
runInstantValidationTests((ctx) => {
registerSuspenseBoundariesTests(ctx)
})
})
import { runInstantValidationTests } from './harness.util'
import { registerSyncIoAndBlockingTests } from './sync-io-and-blocking.util'
runInstantValidationTests((ctx) => {
registerSyncIoAndBlockingTests(ctx)
// @force-gate !deploy
describe('instant validation', () => {
runInstantValidationTests((ctx) => {
registerSyncIoAndBlockingTests(ctx)
})
})
......@@ -3,10 +3,10 @@ import { nextTestSetup } from 'e2e-utils'
const METADATA_BASE_WARN_STRING =
'metadataBase property in metadata export is not set for resolving social open graph or twitter images,'
// @force-gate !deploy
describe('app dir - metadata missing metadataBase', () => {
const { next, isNextDev, skipped } = nextTestSetup({
files: __dirname,
skipDeployment: true,
})
if (skipped) {
......
import { FileRef, nextTestSetup } from 'e2e-utils'
// Deploy tests are broken with `config.serverExternalPackages`
// @force-gate !deploy
describe('`next-js` Condition - Rendering', () => {
const { next, isTurbopack, skipped } = nextTestSetup({
files: __dirname + '/fixtures/render',
......@@ -9,8 +11,6 @@ describe('`next-js` Condition - Rendering', () => {
'sym-linked-packages': new FileRef(__dirname + '/packages'),
},
dependencies: require('./fixtures/render/package.json').dependencies,
// Deploy tests are broken with `config.serverExternalPackages`
skipDeployment: true,
})
if (skipped) {
......@@ -623,6 +623,8 @@ describe('`next-js` Condition - Rendering', () => {
}
})
// Deploy tests are broken with `config.serverExternalPackages`
// @force-gate !deploy
describe('`next-js` Condition - middleware (legacy)', () => {
const { next, skipped } = nextTestSetup({
files: __dirname + '/fixtures/middleware',
......@@ -632,8 +634,6 @@ describe('`next-js` Condition - middleware (legacy)', () => {
'sym-linked-packages': new FileRef(__dirname + '/packages'),
},
dependencies: require('./fixtures/middleware/package.json').dependencies,
// Deploy tests are broken with `config.serverExternalPackages`
skipDeployment: true,
})
if (skipped) {
......@@ -668,6 +668,8 @@ describe('`next-js` Condition - middleware (legacy)', () => {
})
})
// Deploy tests are broken with `config.serverExternalPackages`
// @force-gate !deploy
describe('`next-js` Condition - proxy', () => {
const { next, skipped } = nextTestSetup({
files: __dirname + '/fixtures/proxy',
......@@ -677,8 +679,6 @@ describe('`next-js` Condition - proxy', () => {
'sym-linked-packages': new FileRef(__dirname + '/packages'),
},
dependencies: require('./fixtures/proxy/package.json').dependencies,
// Deploy tests are broken with `config.serverExternalPackages`
skipDeployment: true,
})
if (skipped) {
......@@ -713,6 +713,8 @@ describe('`next-js` Condition - proxy', () => {
})
})
// Deploy tests are broken with `config.serverExternalPackages`
// @force-gate !deploy
describe('`next-js` Condition - instrumentation', () => {
const { next, skipped } = nextTestSetup({
files: __dirname + '/fixtures/instrumentation',
......@@ -723,8 +725,6 @@ describe('`next-js` Condition - instrumentation', () => {
},
dependencies: require('./fixtures/instrumentation/package.json')
.dependencies,
// Deploy tests are broken with `config.serverExternalPackages`
skipDeployment: true,
})
if (skipped) {
......
import { nextTestSetup } from 'e2e-utils'
import { waitForNoRedbox } from 'next-test-utils'
// @force-gate !deploy
describe('app dir - not found with default 404 page', () => {
const { next, isNextDev, skipped } = nextTestSetup({
files: __dirname,
skipDeployment: true,
})
if (skipped) {
......
import { nextTestSetup } from 'e2e-utils'
import { check } from 'next-test-utils'
// @force-gate !deploy
describe('app dir - not-found - basic', () => {
const { next, isNextDev, isNextStart, skipped } = nextTestSetup({
files: __dirname,
skipDeployment: true,
})
if (skipped) {
......
import { nextTestSetup } from 'e2e-utils'
const isAdapterTest = process.env.NEXT_ENABLE_ADAPTER === '1'
// The legacy builder incorrectly replaces this response with the Pages
// Router error page. The adapter preserves the App Router not-found page.
// @force-gate !deploy || adapter
describe('pages-router-app-not-found', () => {
const { next } = nextTestSetup({
files: __dirname,
// The legacy builder incorrectly replaces this response with the Pages
// Router error page. The adapter preserves the App Router not-found page.
skipDeployment: !isAdapterTest,
})
it('fully renders an app not-found selected by a pages route', async () => {
......
import { nextTestSetup } from 'e2e-utils'
import { retry, waitForRedbox, getRedboxDescription } from 'next-test-utils'
// We do not have access to runtime logs when deployed
// @force-gate !deploy
describe('app-dir refresh', () => {
const { next, skipped, isNextDev } = nextTestSetup({
files: __dirname,
// We do not have access to runtime logs when deployed
skipDeployment: true,
})
if (skipped) return
......
......@@ -460,11 +460,11 @@ const cases: {
},
]
// TODO: re-enable once changes in infrastructure are merged
// @force-gate !deploy
describe('rewrite-headers', () => {
const { next, skipped } = nextTestSetup({
files: __dirname,
// TODO: re-enable once changes in infrastructure are merged
skipDeployment: true,
})
if (skipped) return
......
import { nextTestSetup } from 'e2e-utils'
import * as cheerio from 'cheerio'
const isAdapterTest = process.env.NEXT_ENABLE_ADAPTER === '1'
// 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('sub-shell-generation', () => {
const { next, isNextDev, isNextDeploy } = nextTestSetup({
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) {
......
import { execSync } from 'child_process'
import { nextTestSetup } from 'e2e-utils'
// @force-gate !deploy
describe('app-dir types', () => {
const { next, skipped } = nextTestSetup({
files: __dirname,
skipDeployment: true,
skipStart: true,
})
......
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