Repository navigation
test: cover BUILD_ENV default fallback in the real e2e build - #454
hivecommons-hive[bot] wants to merge 1 commit into
Conversation
…real e2e build getBuildContext.ts's 'process.env.BUILD_ENV || production' default is the code path the real Netlify production deploy takes (netlify.toml's build:production script never sets BUILD_ENV), but every existing e2e build explicitly sets BUILD_ENV: 'production' rather than leaving it unset, so the default branch itself was only unit-covered, never end-to-end exercised. Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
Important Ready for review: held for a maintainer by the hive's ACMM level gate. This PR was opened by the "quality" agent while Hive policy required a human checkpoint for that agent. Agent PRs are held at ACMM L3-L5; an The hive's work on this PR is done. Hive will keep the |
✅ Deploy Preview for cncf-techdocs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Read the tree at head 5e9c2d8, not just the diff. The premise checks out end to end:
netlify.toml:6runsnpm run build:production->_build->docus:buildwith noBUILD_ENVanywhere in that chain, so the real production deploy does take theprocess.env.BUILD_ENV || 'production'default atlib/getBuildContext.ts:14.- Every other e2e build in
e2e/linkRewrite.test.mjssetsBUILD_ENVexplicitly (productionat line 167,develsewhere), so before this PR the default literal was only unit-covered (lib/getBuildContext.test.mts:29). - The new suite correctly
deletesBUILD_ENVrather than setting it, and clearingDEPLOY_PRIME_URLis the right call: if the fallback literal regressed,isProdwould go false and a CI-setDEPLOY_PRIME_URLwould otherwise shunt the build into deploy-preview mode, muddying the failure.
Looks correct to me. One non-blocking note for a maintainer: per #390, no CI workflow runs npm test, so this e2e suite (like the existing ones) only guards local/manual runs until a test workflow lands. That is pre-existing and not a defect of this PR.
-- hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.88
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the added default-environment production build coverage.
No open issues 🎉
What changed in this PR
Adds end-to-end coverage for the production build when BUILD_ENV is unset, exercising the default used by real Netlify production deployments.
Changes:
- Builds the site with
BUILD_ENVremoved from the child process environment. - Verifies the production edit-this-page link and
og:url, complementing the existing explicit-production suite.
| File | Description |
|---|---|
e2e/linkRewrite.test.mjs |
Adds a default-environment production build suite with output assertions and temporary-directory cleanup. |
Review effort: Balanced
|
Merge-order note: this PR and #444/#454/#455/#456 (the others in this set) all add tests to
Recommended order: land #444 first, then rebase #454, #455, and #456 on top individually - rebasing the three small diffs once each onto the restructured file is cheaper than rebasing the large restructuring diff three times. No action needed from a human beyond normal review order; this is a heads-up so whichever lands later isn't surprised by the conflict. 🐝 Hive Agent: |
|
closing to save spend. |
Test Improvement
Adds an e2e describe block that builds with
BUILD_ENVdeleted from thechild process env (rather than set to
'production') and asserts thesame production assertions (edit-this-page link,
og:url) as theexisting explicit-
BUILD_ENV=productionsuite.getBuildContext.ts'sprocess.env.BUILD_ENV || 'production'default isthe code path a real Netlify production deploy actually takes
(
netlify.toml'sbuild:productionscript never setsBUILD_ENV), butevery existing e2e build explicitly set
BUILD_ENV: 'production', so the||default itself was only unit-covered(
lib/getBuildContext.test.mts), never end-to-end exercised. A regressionconfined to that default literal would have passed every existing unit
and e2e test while breaking the real production build.
Related Issue
Part of #451 (that issue folds several
e2e/linkRewrite.test.mjscoveragefindings into one tracker; this PR closes the
BUILD_ENVdefault-fallbackvariant specifically. The issue's original
isAsset/assetBaseUrlshort-circuit finding remains open by design - no e2e test is proposed for
it since the branch isn't reachable through this repo's own Docusaurus
wiring without fabricating a config the site doesn't use)
Filed by quality agent (hold-gated mode). Human review required.
-- hive: agent=quality backend=copilot model=claude-opus-4-6 copilot=1.0.88