Unverified Commit d53f1dde authored by Sebastian "Sebbie" Silbermann's avatar Sebastian "Sebbie" Silbermann Committed by GitHub

[test] Fix new deploy suites (#99162)

The `test-e2e-deploy-release` run for `v16.4.0-canary.43` failed three
webpack shards deterministically
([run](https://github.com/vercel/next.js/actions/runs/35989345663))
after #98847 and #98848 removed the deploy-mode exclusions.

On PRs we only run deploy tests for Turbopack so these failures were
missed.

- `use-cache-segment-configs`: #98847 added a deploy-specific snapshot
for Turbopack, but the webpack path still used the local snapshot.
Vercel's fetched build logs strip code-frame indentation and trailing
whitespace, so the deployed output can never match it. The webpack
assertion now has its own deploy branch with the exact formatting Vercel
produces.
- `app-edge-invalid-reexport`: #98848 removed `skipDeployment`, but the
fixture exports `preferredRegion = 'test-region'`, which the Vercel
platform rejects during deployment (`Invalid region: test-region`). The
test now overrides the basic page with a valid region (`iad1`) in deploy
mode. The asserted re-export warnings are build-time diagnostics, so the
region value does not affect them.
- `deprecation-warnings`: both tests call `next.start()` inside the test
body, which `e2e-utils` caps at 60 seconds when no explicit timeout is
given. Deployments now take about two minutes (`Ready in 2m`, up from
`Ready in 1m` in the passing canary.42 run with the same Vercel CLI
59.26.0), so both tests time out on every run. They now pass an explicit
240-second timeout, matching the other deploy tests.

---------
Co-authored-by: 's avatarClaude Code (kimi-k3[1m]) <noreply@anthropic.com>
parent f2c2f781
......@@ -6,4 +6,4 @@ export default function Page() {
}
export const runtime = 'edge'
export const preferredRegion = 'test-region'
export const preferredRegion = 'iad1'
......@@ -130,6 +130,27 @@ describe('use-cache-segment-configs', () => {
> Build failed because of Rspack errors
"
`)
} else if (isNextDeploy) {
// Vercel strips code-frame indentation and trailing whitespace from
// the fetched build logs.
expect(buildOutput).toMatchInlineSnapshot(`
"
// TODO(veil): Fix broken import trace for Webpack loader resource.
Error: x Route segment config "runtime" is not compatible with \`nextConfig.experimental.useCache\`. Please remove it.
,-[1:1]
1 | export const runtime = 'edge'
: ^^^^^^^
2 |
3 | export default function Page() {
4 | return <div>This page uses \`export const runtime\`.</div>
\`----
Import trace for requested module:
// TODO(veil): Fix broken import trace for Webpack loader resource.
> Build failed because of webpack errors"
`)
} else {
expect(buildOutput).toMatchInlineSnapshot(`
"
......
......@@ -4,60 +4,70 @@ import path from 'path'
describe('deprecation-warnings', () => {
describe('without next.config.js', () => {
const { next } = nextTestSetup({
const { next, isNextDeploy } = nextTestSetup({
files: path.join(__dirname, 'fixtures/no-config'),
skipStart: true,
})
it('should not emit any deprecation warnings when no config file exists', async () => {
await next.start()
// React version warnings are covered by the dedicated React version test.
const configLogs = next.cliOutput
.split('\n')
.filter((line) => !line.includes('React 18 support is deprecated'))
.join('\n')
expect(configLogs).not.toContain('deprecated')
expect(configLogs).not.toContain('has been renamed')
expect(configLogs).not.toContain('no longer needed')
})
it(
'should not emit any deprecation warnings when no config file exists',
async () => {
await next.start()
// React version warnings are covered by the dedicated React version test.
const configLogs = next.cliOutput
.split('\n')
.filter((line) => !line.includes('React 18 support is deprecated'))
.join('\n')
expect(configLogs).not.toContain('deprecated')
expect(configLogs).not.toContain('has been renamed')
expect(configLogs).not.toContain('no longer needed')
},
isNextDeploy ? 240_000 : undefined
)
})
describe('with deprecated config options', () => {
const { next } = nextTestSetup({
const { next, isNextDeploy } = nextTestSetup({
files: path.join(__dirname, 'fixtures/with-deprecated-config'),
skipStart: true,
})
it('should emit deprecation warnings for explicitly configured deprecated options', async () => {
await next.start()
it(
'should emit deprecation warnings for explicitly configured deprecated options',
async () => {
await next.start()
await retry(async () => {
const logs = next.cliOutput
await retry(async () => {
const logs = next.cliOutput
// Should warn about experimental.instrumentationHook
expect(logs).toContain('experimental.instrumentationHook')
expect(logs).toContain('no longer needed')
// Should warn about experimental.instrumentationHook
expect(logs).toContain('experimental.instrumentationHook')
expect(logs).toContain('no longer needed')
// Should warn about middleware config options
expect(logs).toContain('experimental.middlewarePrefetch')
expect(logs).toContain(
'Please use `experimental.proxyPrefetch` instead'
)
// Should warn about middleware config options
expect(logs).toContain('experimental.middlewarePrefetch')
expect(logs).toContain(
'Please use `experimental.proxyPrefetch` instead'
)
expect(logs).toContain('experimental.middlewareClientMaxBodySize')
expect(logs).toContain(
'Please use `experimental.proxyClientMaxBodySize` instead'
)
expect(logs).toContain('experimental.middlewareClientMaxBodySize')
expect(logs).toContain(
'Please use `experimental.proxyClientMaxBodySize` instead'
)
expect(logs).toContain('experimental.externalMiddlewareRewritesResolve')
expect(logs).toContain(
'Please use `experimental.externalProxyRewritesResolve` instead'
)
expect(logs).toContain(
'experimental.externalMiddlewareRewritesResolve'
)
expect(logs).toContain(
'Please use `experimental.externalProxyRewritesResolve` instead'
)
expect(logs).toContain('skipMiddlewareUrlNormalize')
expect(logs).toContain('Please use `skipProxyUrlNormalize` instead')
})
})
expect(logs).toContain('skipMiddlewareUrlNormalize')
expect(logs).toContain('Please use `skipProxyUrlNormalize` instead')
})
},
isNextDeploy ? 240_000 : undefined
)
})
})
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