Unverified Commit 627dcba1 authored by Jamiboy Mohammad's avatar Jamiboy Mohammad Committed by GitHub

test: enable upward distDir deployment coverage (#98886)

## Summary

Enable deploy coverage for the nested `upward-distdir` fixture while
preserving its `distDir: '../.next'` configuration and existing
rendering assertion. Configure Vercel to consume `apps/.next`, and reuse
the fixture's `vercel.json` outputDirectory when collecting deployment
metadata.

The metadata script falls back to the existing output path when
vercel.json or its outputDirectory override is absent. No new
nextTestSetup option is needed.

## Verification

- Prettier and ESLint passed.
- Ten executions of the generated metadata command passed: absent
config, absent/null outputDirectory, nested paths and paths containing
spaces, with adapter mode enabled and disabled. Each case also confirmed
that a missing BUILD_ID fails.
- Local bootstrap build blocked by missing package-level dependencies in
the isolated worktree.
- The previous revision passed both normal and cache-components deploy
CI. Deploy validation of this revision is pending CI; no local
deployment was run.

<!-- NEXT_JS_LLM -->
parent 09b98c73
...@@ -2,7 +2,6 @@ import { nextTestSetup, isNextDev } from 'e2e-utils' ...@@ -2,7 +2,6 @@ import { nextTestSetup, isNextDev } from 'e2e-utils'
describe('upward-distdir', () => { describe('upward-distdir', () => {
const { next } = nextTestSetup({ const { next } = nextTestSetup({
skipDeployment: true,
files: __dirname, files: __dirname,
installCommand: 'pnpm install', installCommand: 'pnpm install',
buildCommand: 'pnpm next build apps/next-nx-test', buildCommand: 'pnpm next build apps/next-nx-test',
......
{
"framework": "nextjs",
"buildCommand": "pnpm build",
"outputDirectory": "apps/.next"
}
...@@ -364,7 +364,9 @@ export class NextInstance { ...@@ -364,7 +364,9 @@ export class NextInstance {
? // since we can't get the build id as a build artifact, ? // since we can't get the build id as a build artifact,
// add it in build logs // add it in build logs
{ {
'post-build': `node -e 'console.log("BUILD" + "_ID: " + fs.readFileSync("${this.distDir}/BUILD_ID") + "\\nDEPLOYMENT" + "_ID: " + process.env.NEXT_DEPLOYMENT_ID + "\\nNEXT_SUPPORTS_IMMUTABLE" + "_ASSETS: " + ((process.env.VERCEL_IMMUTABLE_STATIC_FILES_ENABLED && process.env.NEXT_ENABLE_ADAPTER==="1") ? 1 : 0))'`, // Read the deployed fixture's config after its files have
// been written, using the same output directory as Vercel.
'post-build': `node -e 'const config = fs.existsSync("vercel.json") ? JSON.parse(fs.readFileSync("vercel.json", "utf8")) : {}; console.log("BUILD" + "_ID: " + fs.readFileSync((config.outputDirectory ?? "${this.distDir}") + "/BUILD_ID") + "\\nDEPLOYMENT" + "_ID: " + process.env.NEXT_DEPLOYMENT_ID + "\\nNEXT_SUPPORTS_IMMUTABLE" + "_ASSETS: " + ((process.env.VERCEL_IMMUTABLE_STATIC_FILES_ENABLED && process.env.NEXT_ENABLE_ADAPTER==="1") ? 1 : 0))'`,
} }
: {}), : {}),
...pkgScripts, ...pkgScripts,
......
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