Repository navigation
[quality] scripts: add vitest subprocess tests for netlify-ignore.sh (6 cases) - #6972
Conversation
…(6 cases) Adds scripts/netlify-ignore.test.ts covering the Netlify per-build ignore hook, mirroring the subprocess-harness pattern established by scripts/verify-site-health.test.ts (PR #6909). The exit-code contract is the entire point of the script — exit 0 skips the deploy-preview build (used to short-circuit chore/hive-snapshot* automation branches so Netlify preview minutes aren't consumed on throwaway branches), exit 1 proceeds. Inverting either arm silently breaks previews site-wide or wastes runner minutes, a failure mode with no user-facing signal until the bill or the missing preview is noticed. Cases (all four exit-code arms + both env-var surfaces + two glob-narrowness guards): 1. BRANCH=chore/hive-snapshot-abc — exit 0 (skip) 2. HEAD=chore/hive-snapshot-xyz — exit 0 (skip) via HEAD arm 3. BRANCH=main — exit 1 (build) 4. BRANCH="" HEAD="" — exit 1: empty envs must not glob-match 5. BRANCH=chore/hive-snap — exit 1: prefix alone must not match 6. BRANCH=chore/something-else — exit 1: unrelated chore branch All 6 pass locally against HEAD (vitest run scripts/netlify-ignore.test.ts). No production script change; no CI wiring change. Refs #6842 Co-authored-by: Copilot <[email protected]> Signed-off-by: kubestellar-hive[bot] <[email protected]>
❌ Deploy Preview for kubestellar-docs failed. Why did it fail? →
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @kubestellar-hive[bot]. Thanks for your PR. I'm waiting for a kubestellar member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Thank you for your contribution! Your PR has been merged. Check out what's new:
Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey |
…, #6813) (#6990) - scripts/netlify-ignore.test.ts: add NODE_ENV to the literal spawnEnv object so it satisfies NodeJS.ProcessEnv (TS2741), fixing the TypeScript type-check regression from #6972. - Add src/__tests__/NavbarSubcomponents.render.test.tsx covering the six sub-components extracted from Navbar.tsx in #6971 (NavbarLogo, ContributeDropdown, CommunityDropdown, GithubDropdown, MobileMenu, and the navbar/index.ts export surface), restoring src/components/navbar/** above its 95/95/90/80 coverage thresholds. - #6813 (missing vite devDependency) was already fixed on main by PR #6834; verified vite is present in package.json and no longer reproduces, so it is not addressed here. Signed-off-by: kubestellar-hive[bot] <[email protected]> Co-authored-by: kubestellar-hive[bot] <[email protected]>
Test Improvement
Adds
scripts/netlify-ignore.test.ts— 6 vitest subprocess-style cases coveringscripts/netlify-ignore.sh, the Netlify per-build "ignore" hook. Mirrors the harness pattern established byscripts/verify-site-health.test.ts(PR #6909).Why this script matters
netlify-ignore.sh's entire job is to return the right exit code:exit 0→ Netlify skips the build (used to short-circuit deploy previews forchore/hive-snapshot*automation branches so Netlify preview minutes aren't consumed on throwaway branches).exit 1→ Netlify proceeds with the build.Inverting either arm has no user-facing signal until the bill or the missing preview is noticed — a silent, high-cost failure mode with a small (18-line) but load-bearing surface.
The script also has a subtle branch-input surface: Netlify may populate the branch name in either
$BRANCHor$HEADdepending on the trigger, so the script matches either. A refactor dropping one arm would silently reintroduce full preview builds for snapshot PRs on whichever trigger populated the other variable.Cases
All four exit-code arms + both env-var surfaces + two glob-narrowness guards:
BRANCH=chore/hive-snapshot-abcBRANCHHEAD=chore/hive-snapshot-xyzHEADBRANCH=mainBRANCH="" HEAD=""chore/hive-snapshot*BRANCH=chore/hive-snapchore/hive-snap*BRANCH=chore/something-elsechore/*Verification
Scope
scripts/netlify-ignore.shis untouched.bash scripts/netlify-ignore.shwith an explicitly minimal env so leaks from the ambient shell can't accidentally satisfy a case arm.Refs #6842 (part of the "8 of 10 CI automation scripts have zero unit tests" epic; that issue tracks 8 scripts, this PR closes the gap for
netlify-ignore.sh, leaving the remaining scripts open there.)Filed by quality agent (ACMM L4/L6 — full mode)
— hive: agent=quality backend=copilot model=claude-opus-4.7