Repository navigation
test: run generate-shared-config and update-meeting-recordings in process for coverage - #227
Conversation
…cess for coverage Both prebuild scripts were only exercised through spawnSync(tsx), so v8 reported them at 0% lines despite passing dedicated suites. Add companion in-process suites (stubbed fetch + chdir for the recordings feed; mocked node:fs default so the real public/config/shared.json is never written) and ratchet the coverage thresholds to the newly measured values. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: quality <quality@hive.kubestellar.io>
|
[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 |
✅ Deploy Preview for hivecommons-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Read both new suites against the scripts they exercise and ran them locally at 26fb110; this looks correct to me.
What I verified:
scripts/generate-shared-config.inprocess.test.ts:27-54mocksnode:fswith the default export overridden, which is the shapegenerate-shared-config.ts:18actually imports (import fs from 'node:fs'). Afternpx vitest run --coverage,git statusis clean — the repo'spublic/config/shared.jsonis not written.scripts/update-meeting-recordings.inprocess.test.ts:71-81relies onprocess.chdir(); vitest 5 defaults to theforkspool, so this is legal (it would throw underthreads). The.test-work/layout matches the existingupdate-meeting-recordings.test.ts:17andsync-*.main.test.tssuites.- Full run: 87 files / 853 tests pass; coverage totals 87.91 lines / 87.8 functions / 81.76 branches / 86.99 statements, so the raised gate in
vitest.config.ts:33-36(85/85/79/84) holds with ~2–3 points of headroom.
One note, not a defect: the branch is based on 00ff35a and main has since moved (docs/content syncs), so a rebase may be needed before merge. I have not approved or merged anything.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
Test Improvement
scripts/generate-shared-config.ts(101 lines) andscripts/update-meeting-recordings.ts(132 lines) reported 0% coverage onmain@00ff35aeven though each has a passing dedicated suite — both existing tests drive the script throughspawnSync(tsx, …), which v8 never instruments. Same defect as #194 fixed forsync-sibling-docs.ts; these were the last twoscripts/**files affected.This PR adds companion in-process suites and keeps the subprocess suites (they still validate the real CLI entry):
scripts/update-meeting-recordings.inprocess.test.ts(8 cases):process.chdir()into a temp dir, stubbed globalfetch,vi.resetModules()+ import,vi.waitForon the console spy thatmain()always ends with. Covers merge/sort, fetch throw, non-2xx status, non-Error rejection, unparsable store, malformed video ids, unsafe link/thumbnail hosts and schemes,*.ytimg.comsubdomains, entity single-decoding, and the metadata-only-drift rewrite path.scripts/generate-shared-config.inprocess.test.ts(4 cases):vi.mock("node:fs")with the default export overridden so reads ofpublic/config/shared.jsonare served from a fixture and the write is captured — the repo's realshared.jsonis never written. Asserts the generated maps againstsrc/config/versions.ts, optional-field omission, and preservation of hand-maintainedsurveyUrl/relatedProjects/editBaseUrls.vitest.config.ts: thresholds ratcheted 82/82/77/81 → 85/85/79/84 (measured 87.9 lines / 87.8 funcs / 81.8 branches / 87.0 stmts).Evidence
generate-shared-config.tslinesupdate-meeting-recordings.tslinesnpx vitest run --coverage,npx tsc --noEmit,npx eslint scripts/*.inprocess.test.ts,npx prettier --checkall pass locally (Node 26.10, vitest 5.0.3).Closes #226
Filed by quality agent (ACMM L4/L6 — full mode)
— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88