mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
e0966df114
## 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 -->
64 lines
2.3 KiB
TypeScript
64 lines
2.3 KiB
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
|
import {
|
|
waitForRedbox,
|
|
getRedboxDescription,
|
|
getRedboxSource,
|
|
} 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', () => {
|
|
const { next, isNextDev, isTurbopack } = nextTestSetup({
|
|
files: __dirname,
|
|
skipStart: true,
|
|
})
|
|
|
|
it("should error when route handlers use segment configs that aren't supported by cacheComponents", async () => {
|
|
try {
|
|
await next.start()
|
|
} catch {
|
|
// we expect the build to fail
|
|
}
|
|
|
|
if (isNextDev) {
|
|
// Test the first route handler with "dynamic" config
|
|
const browser = await next.browser('/route-with-dynamic')
|
|
await waitForRedbox(browser)
|
|
const redbox = {
|
|
description: await getRedboxDescription(browser),
|
|
source: await getRedboxSource(browser),
|
|
}
|
|
|
|
if (isTurbopack) {
|
|
expect(redbox.description).toMatchInlineSnapshot(
|
|
`"Route segment config "dynamic" is not compatible with \`nextConfig.cacheComponents\`. Please remove it."`
|
|
)
|
|
} else {
|
|
expect(redbox.description).toMatchInlineSnapshot(
|
|
`" x Route segment config "dynamic" is not compatible with \`nextConfig.cacheComponents\`. Please remove it."`
|
|
)
|
|
}
|
|
expect(redbox.source).toContain(
|
|
'"dynamic" is not compatible with `nextConfig.cacheComponents`. Please remove it.'
|
|
)
|
|
} else {
|
|
// In build mode, check for all three errors in the output
|
|
expect(next.cliOutput).toContain('./app/route-with-dynamic/route.ts')
|
|
expect(next.cliOutput).toContain(
|
|
'"dynamic" is not compatible with `nextConfig.cacheComponents`. Please remove it.'
|
|
)
|
|
|
|
expect(next.cliOutput).toContain('./app/route-with-revalidate/route.ts')
|
|
expect(next.cliOutput).toContain(
|
|
'"revalidate" is not compatible with `nextConfig.cacheComponents`. Please remove it.'
|
|
)
|
|
|
|
expect(next.cliOutput).toContain('./app/route-with-fetchcache/route.ts')
|
|
expect(next.cliOutput).toContain(
|
|
'"fetchCache" is not compatible with `nextConfig.cacheComponents`. Please remove it.'
|
|
)
|
|
}
|
|
})
|
|
})
|