Unverified Commit 8af1fab7 authored by Josh Story's avatar Josh Story Committed by GitHub

test: migrate asset deploy exclusions to force gates (#98158)

## Summary

Migrate the remaining image, font, CSS, and other asset integration
deployment exclusions to `@force-gate` and remove their
`skipDeployment`/`skipped` control flow. This stack is rooted at canary
and independent of #98430; it preserves deployment coverage already
enabled on canary.

Shared image-optimizer exclusions are placed on the calling test suites
because gate pragmas are transformed only in test files. Existing
bundler guards in the shared helper are preserved.

## Verification

- Compared test registration against canary in development, production,
and deploy modes with test bodies and hooks disabled. Existing active
deployment assertions are preserved; development/production test
selection is unchanged apart from replacing empty skip placeholders with
skipped real tests. Checked both Webpack and Turbopack.
- TypeScript, Prettier, and ESLint checks passed. Registration probes
use a default config for lazy predicates and do not exercise fixture
setup or test bodies.
- Full bootstrap attempted, but the local native SWC build fails at
`cargo metadata` with `EPERM`; full integration/deployment execution
remains for CI.

<!-- NEXT_JS_LLM -->

---------
Co-authored-by: 's avatarJamiboy Mohammad <jamiboym@gmail.com>
parent 3ca20b5a
import { nextTestSetup } from 'e2e-utils'
import { check } from 'next-test-utils'
// 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('app dir - css', () => {
const { next, isNextDev, skipped } = nextTestSetup({
const { next, isNextDev } = nextTestSetup({
files: __dirname,
skipDeployment: true,
dependencies: {
'@picocss/pico': '1.5.7',
sass: 'latest',
......@@ -12,10 +14,6 @@ describe('app dir - css', () => {
},
})
if (skipped) {
return
}
describe('css support', () => {
describe('server layouts', () => {
it.skip('should support global css inside server layouts', async () => {
......
......@@ -474,7 +474,6 @@ const options = (value: CssChunkingValue) => ({
dependencies: {
sass: 'latest',
},
skipDeployment: true,
})
/**
......@@ -514,11 +513,13 @@ function shouldSkipConflict(ordering: readonly string[]): boolean {
)
}
// TODO(deploy-test-completion): No deploy-specific incompatibility is
// documented.
// @force-gate !deploy
describe.each(process.env.IS_TURBOPACK_TEST ? TURBO_MODES : WEBPACK_MODES_TRUE)(
'css-order %s',
(_label: string, value: CssChunkingValue) => {
const { next, isNextDev, skipped } = nextTestSetup(options(value))
if (skipped) return
const { next, isNextDev } = nextTestSetup(options(value))
for (const ordering of allPairs) {
const name = `should load correct styles navigating back again ${ordering.join(
' -> '
......@@ -568,6 +569,9 @@ describe.each(process.env.IS_TURBOPACK_TEST ? TURBO_MODES : WEBPACK_MODES_TRUE)(
}
}
)
// TODO(deploy-test-completion): No deploy-specific incompatibility is
// documented.
// @force-gate !deploy
describe.each(
process.env.IS_TURBOPACK_TEST ? TURBO_MODES : WEBPACK_MODES_LOOSE
)('css-order %s', (_label: string, value: CssChunkingValue) => {
......@@ -611,6 +615,9 @@ describe.each(
})
}
})
// TODO(deploy-test-completion): No deploy-specific incompatibility is
// documented.
// @force-gate !deploy
describe.each(
process.env.IS_TURBOPACK_TEST ? TURBO_MODES : WEBPACK_MODES_LOOSE
)('css-order %s', (_label: string, value: CssChunkingValue) => {
......@@ -650,6 +657,8 @@ describe.each(
// Webpack currently applies the client child's CSS module after the parent module in
// App Router server-component-with-client-child cases. Gate only those known divergences;
// the other package sideEffects scenarios share expectations across both bundlers.
// The fixture creates dummy packages locally; they are unavailable to deployment builds.
// @force-gate !deploy
describe.each(
process.env.IS_TURBOPACK_TEST ? TURBO_MODES : WEBPACK_MODES_LOOSE
)('css-order sideEffects %s', (_label: string, value: CssChunkingValue) => {
......
......@@ -3,16 +3,14 @@ import { listClientChunks } from 'next-test-utils'
import fs from 'node:fs/promises'
import path from 'node:path'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely reads files from the isolated local fixture.
// @force-gate !deploy
describe('css-server-chunks', () => {
const { next, skipped } = nextTestSetup({
const { next } = nextTestSetup({
files: __dirname,
skipDeployment: true,
})
if (skipped) {
return
}
it('should not write CSS chunks for the server', async () => {
// Fetch all routes to compile them in development
expect((await next.fetch('/client')).status).toBe(200)
......
......@@ -18,12 +18,11 @@ const getAttrs = (elems: Cheerio) =>
.sort((a, b) => (a.href < b.href ? -1 : 1))
describe('app dir - next/font', () => {
// 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('app dir - next-font', () => {
const {
next,
isNextDev: isDev,
skipped,
} = nextTestSetup({
const { next, isNextDev: isDev } = nextTestSetup({
files: {
app: new FileRef(join(__dirname, 'app')),
fonts: new FileRef(join(__dirname, 'fonts')),
......@@ -33,13 +32,8 @@ describe('app dir - next/font', () => {
dependencies: {
'@next/font': 'workspace:*',
},
skipDeployment: true,
})
if (skipped) {
return
}
describe('import values', () => {
it('should have correct values at /', async () => {
const $ = await next.render$('/')
......
......@@ -8,15 +8,14 @@ import { nextTestSetup } from 'e2e-utils'
let proxyPort
let proxyServer: https.Server
// Deploy mode exclusion: This suite controls a local server or proxy process.
// This test is skipped when deployed because it relies on a proxy server
// @force-gate !deploy
describe('next-image-proxy', () => {
const { next, skipped } = nextTestSetup({
const { next } = nextTestSetup({
files: __dirname,
// This test is skipped when deployed because it relies on a proxy server
skipDeployment: true,
})
if (skipped) return
beforeAll(async () => {
proxyPort = await findPort()
......
import { nextTestSetup } from 'e2e-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('no-double-tailwind-execution', () => {
const { next, isNextDev, skipped } = nextTestSetup({
const { next, isNextDev } = nextTestSetup({
files: __dirname,
skipDeployment: true,
dependencies: {
'@tailwindcss/postcss': '^4',
tailwindcss: '^4',
......@@ -15,10 +17,6 @@ describe('no-double-tailwind-execution', () => {
},
})
if (skipped) {
return
}
it('should run tailwind only once initially and per change', async () => {
const browser = await next.browser('/')
expect(await browser.elementByCss('p').text()).toBe('hello world')
......
......@@ -6,6 +6,8 @@ const nextConfig = {
productionBrowserSourceMaps: true,
}
// This suite reads emitted CSS and source maps from the local build output.
// @force-gate !deploy
describe.each([
{ dependencies: { sass: '1.54.0' }, nextConfig },
{
......@@ -18,17 +20,15 @@ describe.each([
},
},
])('SCSS Support ($dependencies)', ({ dependencies, nextConfig }) => {
const { next, isNextDev, skipped } = nextTestSetup({
const { next } = nextTestSetup({
files: __dirname,
// This test is skipped because it is reading files in the `.next` file which
// isn't available/necessary in a deployment environment.
skipDeployment: true,
dependencies,
nextConfig,
})
if (skipped) return // TODO: Figure out this test for dev and Turbopack
;(isNextDev ? describe.skip : describe)('Production only', () => {
// This section only asserts production build output.
// @force-gate !dev
describe('Production only', () => {
describe('CSS Compilation and Prefixing', () => {
it(`should've compiled and prefixed`, async () => {
const $ = await next.render$('/')
......
......@@ -5,16 +5,16 @@ import cheerio from 'cheerio'
import { findPort } from 'next-test-utils'
import { nextTestSetup, isNextDev, isNextStart } from 'e2e-utils'
// Deploy mode exclusion: This suite controls a local server or proxy process.
// Calls `next.build()` and uses an in-test proxy in front of the Next
// server; both rely on the local-process model and are not applicable to
// deploy mode.
// @force-gate !deploy
describe('CSS Module client-side navigation', () => {
const { next, skipped } = nextTestSetup({
const { next } = nextTestSetup({
files: __dirname,
skipStart: true,
// Calls `next.build()` and uses an in-test proxy in front of the Next
// server; both rely on the local-process model and are not applicable to
// deploy mode.
skipDeployment: true,
})
if (skipped) return
let proxyServer: http.Server
let proxyPort: number
......
import { setupTests } from './util'
// Deployments use the Vercel image CDN instead of the local image pipeline.
// @force-gate !deploy
describe('with contentDispositionType inline', () => {
setupTests({
nextConfigImages: { contentDispositionType: 'inline' },
......
import { setupTests } from './util'
// Deployments use the Vercel image CDN instead of the local image pipeline.
// @force-gate !deploy
describe('with dangerouslyAllowSVG config', () => {
setupTests({
nextConfigImages: { dangerouslyAllowSVG: true },
......
import { setupTests } from './util'
// Deployments use the Vercel image CDN instead of the local image pipeline.
// @force-gate !deploy
describe('with isrFlushToDisk false config', () => {
setupTests({
nextConfigExperimental: { isrFlushToDisk: false },
......
......@@ -13,14 +13,15 @@ function toQueryString(query: Record<string, any>): string {
const largeSize = 1080
// Preserve the file-wide deploy exclusion previously imposed by skipDeployment's it.only.
// @force-gate !deploy
describe('Image Optimizer', () => {
// These checks inspect local build errors and cannot run against a deployment.
describe('config checks', () => {
const { next, skipped } = nextTestSetup({
const { next } = nextTestSetup({
files: join(__dirname, 'app'),
skipStart: true,
skipDeployment: true,
})
if (skipped) return
const configChecks: Array<{
name: string
......
import { setupTests } from './util'
// Deployments use the Vercel image CDN instead of the local image pipeline.
// @force-gate !deploy
describe('with maximumDiskCacheSize 85KB config', () => {
setupTests({
nextConfigImages: {
......
import { setupTests } from './util'
// Deployments use the Vercel image CDN instead of the local image pipeline.
// @force-gate !deploy
describe('with maximumDiskCacheSize zero config', () => {
setupTests({
nextConfigImages: {
......
import { setupTests } from './util'
// Deployments use the Vercel image CDN instead of the local image pipeline.
// @force-gate !deploy
describe('with maximumRedirects 0', () => {
setupTests({
nextConfigImages: {
......
import { setupTests } from './util'
// Deployments use the Vercel image CDN instead of the local image pipeline.
// @force-gate !deploy
describe('with maximumRedirects 1', () => {
setupTests({
nextConfigImages: {
......
import { setupTests } from './util'
// Deployments use the Vercel image CDN instead of the local image pipeline.
// @force-gate !deploy
describe('with minimumCacheTTL of 5 sec', () => {
setupTests({
nextConfigImages: {
......
import { setupTests } from './util'
// Deployments use the Vercel image CDN instead of the local image pipeline.
// @force-gate !deploy
describe('with latest sharp', () => {
setupTests({})
})
......@@ -1764,19 +1764,12 @@ export const setupTests = (ctx: SetupTestsCtx) => {
if (!ctx.nextConfigImages) {
maybeSkipTurbopackProd('w/o next.config.js', () => {
const size = 384
const { next, isNextDeploy } = nextTestSetup({
const { next } = nextTestSetup({
files: join(__dirname, 'app'),
nextConfig: ctx.nextConfigExperimental
? { experimental: ctx.nextConfigExperimental }
: undefined,
// The image optimizer suite asserts on the local Next.js image
// pipeline (custom upstream HTTP server, on-disk cache, response
// headers from `/_next/image`). Vercel's deploy serves images
// through its own image CDN with different headers, paths, and
// cache semantics, so these assertions don't apply.
skipDeployment: true,
})
if (isNextDeploy) return
runTests({
next,
......@@ -1805,7 +1798,7 @@ export const setupTests = (ctx: SetupTestsCtx) => {
...ctx.nextConfigImages,
}
const { next, isNextDeploy } = nextTestSetup({
const { next } = nextTestSetup({
files: join(__dirname, 'app'),
nextConfig: {
images: mergedImages,
......@@ -1813,14 +1806,7 @@ export const setupTests = (ctx: SetupTestsCtx) => {
? { experimental: ctx.nextConfigExperimental }
: {}),
},
// The image optimizer suite asserts on the local Next.js image
// pipeline (custom upstream HTTP server, on-disk cache, response
// headers from `/_next/image`). Vercel's deploy serves images
// through its own image CDN with different headers, paths, and
// cache semantics, so these assertions don't apply.
skipDeployment: true,
})
if (isNextDeploy) return
runTests({
next,
......
......@@ -3,16 +3,17 @@ import type { Server } from 'http'
import { findPort } from 'next-test-utils'
import { nextTestSetup, isNextDev } from 'e2e-utils'
// 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('next/dynamic with assetPrefix', () => {
const { next, skipped } = nextTestSetup({
const { next } = nextTestSetup({
files: __dirname,
skipStart: true,
dependencies: {
sass: '1.54.0',
},
skipDeployment: true,
})
if (skipped) return
let cdnPort: number
let cdn: Server
......
......@@ -7,12 +7,9 @@ const mockedGoogleFontResponses = require.resolve(
'./google-font-mocked-responses.js'
)
// Deploy mode exclusion: This suite passes an absolute local mocked-font-response path into the build.
// @force-gate !deploy
describe('next/font/google basepath', () => {
if ((global as any).isNextDeploy) {
it('should skip next deploy for now', () => {})
return
}
const { next } = nextTestSetup({
files: {
pages: new FileRef(join(__dirname, 'basepath/pages')),
......
......@@ -5,15 +5,12 @@ const mockedGoogleFontResponses = require.resolve(
'./google-font-mocked-responses.js'
)
// Deploy mode exclusion: This suite intentionally fails the build, so there is no successful deployment to exercise.
// @force-gate !deploy
describe('next/font/google fetch error', () => {
const isDev = (global as any).isNextDev
const isTurbopack = !!process.env.IS_TURBOPACK_TEST
if ((global as any).isNextDeploy) {
it('should skip next deploy for now', () => {})
return
}
const { next } = nextTestSetup({
files: {
pages: new FileRef(join(__dirname, 'google-fetch-error/pages')),
......
......@@ -35,12 +35,9 @@ function hrefMatchesFontWithoutSizeAdjust(href: string) {
}
}
// Deploy mode exclusion: This suite passes an absolute local mocked-font-response path into the build.
// @force-gate !deploy
describe('next/font', () => {
if ((global as any).isNextDeploy) {
it('should skip next deploy for now', () => {})
return
}
const { next } = nextTestSetup({
files: {
pages: new FileRef(join(__dirname, `app/pages`)),
......
......@@ -9,12 +9,9 @@ const mockedGoogleFontResponses = require.resolve(
const isDev = (global as any).isNextDev
// Deploy mode exclusion: This suite passes an absolute local mocked-font-response path into the build.
// @force-gate !deploy
describe('next/font/google with-font-declarations-file', () => {
if ((global as any).isNextDeploy) {
it('should skip next deploy for now', () => {})
return
}
const { next } = nextTestSetup({
files: join(__dirname, 'with-font-declarations-file'),
env: {
......
......@@ -3,12 +3,9 @@ import { findPort, renderViaHTTP, fetchViaHTTP } from 'next-test-utils'
import { join } from 'path'
import spawn from 'cross-spawn'
// Deploy mode exclusion: This suite spawns a local proxy process.
// @force-gate !deploy
describe('next/font/google with proxy', () => {
if ((global as any).isNextDeploy) {
it('should skip next deploy', () => {})
return
}
const { next } = nextTestSetup({
files: new FileRef(join(__dirname, 'with-proxy')),
skipStart: true,
......
......@@ -7,12 +7,9 @@ const mockedGoogleFontResponses = require.resolve(
'./google-font-mocked-responses.js'
)
// Deploy mode exclusion: This suite passes an absolute local mocked-font-response path into the build.
// @force-gate !deploy
describe('next/font/google without-preloaded-fonts without _app', () => {
if ((global as any).isNextDeploy) {
it('should skip next deploy for now', () => {})
return
}
const { next } = nextTestSetup({
files: {
'pages/no-preload.js': new FileRef(
......@@ -53,12 +50,9 @@ describe('next/font/google without-preloaded-fonts without _app', () => {
})
})
// Deploy mode exclusion: This suite passes an absolute local mocked-font-response path into the build.
// @force-gate !deploy
describe('next/font/google no preloads with _app', () => {
if ((global as any).isNextDeploy) {
it('should skip next deploy for now', () => {})
return
}
const { next } = nextTestSetup({
files: {
'pages/_app.js': new FileRef(
......
......@@ -2,6 +2,8 @@ import { FileRef, nextTestSetup } from 'e2e-utils'
import { waitFor } from 'next-test-utils'
import path from 'path'
// 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('next-image-forward-ref', () => {
const appDir = path.join(__dirname, 'app')
......
import { nextTestSetup, isNextDev, type Playwright } from 'e2e-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('Build Error Tests for basePath', () => {
const { next } = nextTestSetup({
files: __dirname,
skipStart: true,
skipDeployment: true,
})
if (isNextDev) {
......@@ -31,12 +33,13 @@ describe('Build Error Tests for basePath', () => {
})
})
// 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('Static Image Component Tests for basePath', () => {
const { next, isTurbopack, skipped } = nextTestSetup({
const { next, isTurbopack } = nextTestSetup({
files: __dirname,
skipDeployment: true,
})
if (skipped) return
let browser: Playwright
let html: string
......
......@@ -7,20 +7,20 @@ import {
retry,
} from 'next-test-utils'
// Deploy mode exclusion: This suite reads local build artifacts that deployments do not expose.
// Image URL assertions construct expected URLs via
// `getDeploymentId(next.testDir, ...)`, which reads the local
// `.next/required-server-files.json`. In deploy mode that file lives on
// Vercel's infrastructure (not on disk locally), so the constructed
// expected URL omits the `&dpl=...` query that Vercel injects at
// runtime. The assertions are about local-build URL shape, not deploy
// CDN URLs, so skip in deploy.
// @force-gate !deploy
describe('Legacy Image Component basePath Tests', () => {
const { next, skipped } = nextTestSetup({
const { next } = nextTestSetup({
files: __dirname,
disableAutoSkewProtection: true,
// Image URL assertions construct expected URLs via
// `getDeploymentId(next.testDir, ...)`, which reads the local
// `.next/required-server-files.json`. In deploy mode that file lives on
// Vercel's infrastructure (not on disk locally), so the constructed
// expected URL omits the `&dpl=...` query that Vercel injects at
// runtime. The assertions are about local-build URL shape, not deploy
// CDN URLs, so skip in deploy.
skipDeployment: true,
})
if (skipped) return
let dpl: string
beforeAll(() => {
......
......@@ -7,13 +7,14 @@ import {
} from 'e2e-utils'
import cheerio from 'cheerio'
// 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('Build Error Tests', () => {
const { next, isTurbopack, isRspack, isNextDeploy } = nextTestSetup({
const { next, isTurbopack, isRspack } = nextTestSetup({
files: __dirname,
skipStart: true,
skipDeployment: true,
})
if (isNextDeploy) return
;(isNextStart ? it : it.skip)(
'should throw build error when import statement is used with missing file',
async () => {
......@@ -43,6 +44,8 @@ describe('Build Error Tests', () => {
)
})
// Preserve the sibling suite's deploy exclusion previously imposed by skipDeployment's it.only.
// @force-gate !deploy
describe('Static Image Component Tests', () => {
const { next, isTurbopack } = nextTestSetup({
files: __dirname,
......
import { nextTestSetup, isNextDev, isNextStart } from 'e2e-utils'
import { nextTestSetup } from 'e2e-utils'
import fs from 'fs-extra'
import { join } 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('TypeScript Image Component', () => {
const { next, skipped } = nextTestSetup({
const { next } = nextTestSetup({
files: __dirname,
skipStart: true,
skipDeployment: true,
})
if (skipped) return
if (isNextStart) {
// @force-gate start
describe('production', () => {
it('should fail to build invalid usage of the Image component', async () => {
const { cliOutput, exitCode } = await next.build()
expect(cliOutput).toMatch(/Failed to type check/)
......@@ -41,9 +43,10 @@ describe('TypeScript Image Component', () => {
)
expect(envTypes).not.toContain('image-types/global')
})
}
})
if (isNextDev) {
// @force-gate dev
describe('development', () => {
let output = ''
beforeAll(async () => {
......@@ -95,5 +98,5 @@ describe('TypeScript Image Component', () => {
)
expect(envTypes).not.toContain('image-types/global')
})
}
})
})
......@@ -5,10 +5,12 @@ import {
waitForRedbox,
} from 'next-test-utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely inspects local build artifacts that deploy tests do not expose.
// @force-gate !deploy
describe('Image localPatterns config', () => {
const { next } = nextTestSetup({
files: __dirname,
skipDeployment: true,
})
async function getSrc(browser: Playwright, id: string) {
......
import { nextTestSetup, isNextDev, type Playwright } from 'e2e-utils'
import { waitForNoRedbox } from 'next-test-utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely inspects local build artifacts that deploy tests do not expose.
// @force-gate !deploy
describe('Image qualities config', () => {
const { next } = nextTestSetup({
files: __dirname,
skipDeployment: true,
})
async function getSrc(browser: Playwright, id: string) {
......
......@@ -11,13 +11,14 @@ import { nextTestSetup, isNextDev } from 'e2e-utils'
import { existsSync } from 'fs'
import { join } from 'path'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely inspects local build artifacts that deploy tests do not expose.
// @force-gate !deploy
describe('Image Component App Dir Tests', () => {
const { next, skipped } = nextTestSetup({
const { next } = nextTestSetup({
files: __dirname,
skipDeployment: true,
disableAutoSkewProtection: true,
})
if (skipped) return
let dpl: string
let assetDpl: string
......
import { nextTestSetup, isNextDev, type Playwright } from 'e2e-utils'
import cheerio from 'cheerio'
// 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('Build Error Tests', () => {
const { next, isTurbopack, isRspack, isNextDeploy } = nextTestSetup({
const { next, isTurbopack, isRspack } = nextTestSetup({
files: __dirname,
skipStart: true,
skipDeployment: true,
})
if (isNextDeploy) return
if (isNextDev) {
it('no-op in dev', () => {})
......@@ -40,12 +41,13 @@ describe('Build Error Tests', () => {
})
})
// 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('Static Image Component Tests for basePath', () => {
const { next, isTurbopack, skipped } = nextTestSetup({
const { next, isTurbopack } = nextTestSetup({
files: __dirname,
skipDeployment: true,
})
if (skipped) return
let browser: Playwright
let $: ReturnType<typeof cheerio.load>
......
......@@ -7,20 +7,20 @@ import {
retry,
} from 'next-test-utils'
// Deploy mode exclusion: This suite reads local build artifacts that deployments do not expose.
// Image URL assertions construct expected URLs via
// `getDeploymentId(next.testDir, ...)`, which reads the local
// `.next/required-server-files.json`. In deploy mode that file lives on
// Vercel's infrastructure (not on disk locally), so the constructed
// expected URL omits the `&dpl=...` query that Vercel injects at
// runtime. The assertions are about local-build URL shape, not deploy
// CDN URLs, so skip in deploy.
// @force-gate !deploy
describe('Image Component basePath Tests', () => {
const { next, skipped } = nextTestSetup({
const { next } = nextTestSetup({
files: __dirname,
disableAutoSkewProtection: true,
// Image URL assertions construct expected URLs via
// `getDeploymentId(next.testDir, ...)`, which reads the local
// `.next/required-server-files.json`. In deploy mode that file lives on
// Vercel's infrastructure (not on disk locally), so the constructed
// expected URL omits the `&dpl=...` query that Vercel injects at
// runtime. The assertions are about local-build URL shape, not deploy
// CDN URLs, so skip in deploy.
skipDeployment: true,
})
if (skipped) return
let dpl: string
beforeAll(() => {
......
import { nextTestSetup, isNextDev } from 'e2e-utils'
import { getDeploymentId } from 'next-test-utils'
// Deploy mode exclusion: This suite reads local build artifacts that deployments do not expose.
// Image URL assertions construct expected URLs via
// `getDeploymentId(next.testDir, ...)`, which reads the local
// `.next/required-server-files.json`. In deploy mode that file lives on
// Vercel's infrastructure (not on disk locally), so the constructed
// expected URL omits the `&dpl=...` query that Vercel injects at
// runtime. The assertions are about local-build URL shape, not deploy
// CDN URLs, so skip in deploy.
// @force-gate !deploy
describe('Image Component basePath + trailingSlash Tests', () => {
const { next, skipped } = nextTestSetup({
const { next } = nextTestSetup({
files: __dirname,
disableAutoSkewProtection: true,
// Image URL assertions construct expected URLs via
// `getDeploymentId(next.testDir, ...)`, which reads the local
// `.next/required-server-files.json`. In deploy mode that file lives on
// Vercel's infrastructure (not on disk locally), so the constructed
// expected URL omits the `&dpl=...` query that Vercel injects at
// runtime. The assertions are about local-build URL shape, not deploy
// CDN URLs, so skip in deploy.
skipDeployment: true,
})
if (skipped) return
let dpl: string
let assetDpl: string
......
import { nextTestSetup, isNextDev, type Playwright } from 'e2e-utils'
import cheerio from 'cheerio'
// 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('Build Error Tests', () => {
const { next, isNextDeploy, isRspack } = nextTestSetup({
const { next, isRspack } = nextTestSetup({
files: __dirname,
skipStart: true,
skipDeployment: true,
disableAutoSkewProtection: true,
})
if (isNextDeploy) return
if (isNextDev) {
it('no-op in dev', () => {})
......@@ -37,13 +38,14 @@ describe('Build Error Tests', () => {
})
})
// 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('Static Image Component Tests', () => {
const { next, isTurbopack, skipped } = nextTestSetup({
const { next, isTurbopack } = nextTestSetup({
files: __dirname,
skipDeployment: true,
disableAutoSkewProtection: true,
})
if (skipped) return
let browser: Playwright
let $: ReturnType<typeof cheerio.load>
......
......@@ -12,16 +12,16 @@ import { isReact18, nextTestSetup, isNextDev } from 'e2e-utils'
import { existsSync } from 'fs'
import { join } from 'path'
// Deploy mode exclusion: This suite reads local build artifacts that deployments do not expose.
// Image URL assertions assume local-relative `/_next/image?url=...`
// paths and access to `.next/static` on disk; deploy mode rewrites URLs
// through the Vercel hostname and has no on-disk `.next/`.
// @force-gate !deploy
describe('Image Component Default Tests', () => {
const { next, skipped } = nextTestSetup({
const { next } = nextTestSetup({
files: __dirname,
disableAutoSkewProtection: true,
// Image URL assertions assume local-relative `/_next/image?url=...`
// paths and access to `.next/static` on disk; deploy mode rewrites URLs
// through the Vercel hostname and has no on-disk `.next/`.
skipDeployment: true,
})
if (skipped) return
let dpl: string
let assetDpl: string
......
import { nextTestSetup, isNextDev } from 'e2e-utils'
import { retry } 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('TypeScript Image Component Build Errors', () => {
if (isNextDev) {
it('no-op in dev', () => {})
......@@ -10,7 +13,6 @@ describe('TypeScript Image Component Build Errors', () => {
const { next } = nextTestSetup({
files: __dirname,
skipStart: true,
skipDeployment: true,
})
it('should fail to build invalid usage of the Image component', async () => {
......
import { nextTestSetup, isNextDev } from 'e2e-utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely inspects local build artifacts that deploy tests do not expose.
// @force-gate !deploy
describe('Image Component Unicode Image URL', () => {
const { next } = nextTestSetup({
files: __dirname,
skipDeployment: true,
})
it('should load static unicode image', async () => {
......
import { nextTestSetup, isNextDev } from 'e2e-utils'
import { retry } from 'next-test-utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely inspects local build artifacts that deploy tests do not expose.
// @force-gate !deploy
describe('Unoptimized Image Tests', () => {
const { next } = nextTestSetup({
files: __dirname,
skipDeployment: true,
})
function runTests(url: string) {
......
import { FileRef, nextTestSetup } from 'e2e-utils'
import { join } from 'path'
// 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('postcss-config-cjs', () => {
const { next } = nextTestSetup({
files: new FileRef(join(__dirname, 'app')),
......
import { isNextDeploy, nextTestSetup } from 'e2e-utils'
import { nextTestSetup } from 'e2e-utils'
import { retry } from 'next-test-utils'
// `experimental.turbopackWorkerAssetPrefix` is turbopack-only.
const isTurbopack = !process.env.IS_WEBPACK_TEST && !process.env.NEXT_RSPACK
const describeTurbopack =
isTurbopack && !isNextDeploy ? describe : describe.skip
// CORS so cross-origin script tags from `assetPrefix` can be fetched. Workers
// are NOT covered by CORS — `new Worker(crossOriginUrl)` is rejected
// regardless — so this only unblocks regular script loading.
......@@ -29,7 +24,10 @@ const corsHeadersConfig = `
* runtime helper resolved from `turbopackWorkerAssetPrefix`, so each test
* can assert on that URL directly.
*/
describeTurbopack('turbopack-worker-asset-prefix', () => {
// `experimental.turbopackWorkerAssetPrefix` is turbopack-only.
// Deploy mode exclusion: This suite models cross-origin loading with `localhost` and `127.0.0.1` on a local port.
// @force-gate turbopack && !deploy
describe('turbopack-worker-asset-prefix', () => {
describe('without turbopackWorkerAssetPrefix (cross-origin assetPrefix)', () => {
const { next } = nextTestSetup({
files: __dirname,
......
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