Enable Vitest coverage in CI
Problem¶
Coverage thresholds are configured only in packages/portable-text and packages/widget-renderers (vitest.config.ts). The apps run hundreds of tests but real line coverage is unknown:
apps/cms/vitest.config.tsandapps/lms/vitest.config.tshave nocoverageblock.- CI (.github/workflows/ci.yml) runs
turbo run testwithout coverage flags. @vitest/coverage-v8is already hoisted at the rootpackage.json, andturbo.json'stesttask already declarescoverage/**outputs.
Proposal¶
- Add a
coverageblock to both apps'vitest.config.ts: - Add an npm script
test:coverageto each app (CMS already has one; align flags/output dir). - Update CI to run
npm run test:coverage(orturbo run test:coverage) on PRs and uploadcoverage/as a GitHub Actions artifact for both apps. - Document the baseline coverage numbers in this ticket's notes once first run completes.
- Follow-up (not part of this ticket): ratchet to 70% lines per app after baseline is known.
Acceptance criteria¶
- Both apps emit
coverage/coverage-summary.jsonaftertest:coverage. - CI artifact contains coverage for cms and lms.
- No thresholds enforced yet; first baseline numbers recorded in the notes log below.
-
npm run checkpasses.
Out of scope¶
- Threshold enforcement (separate follow-up ticket once baselines are known).
- Coverage upload to a third-party service (e.g. Codecov).
- Mutation testing or branch coverage tuning.
Notes / decisions log¶
- 2026-05-24: Ticket created from monorepo audit.
- 2026-05-25: Implemented baseline coverage for apps and packages. CI runs
turbo run test:coverageand uploads artifactvitest-coverage. Package thresholds (85% on portable-text / widget-renderers) removed until a ratchet follow-up; localtest:coveragereports only. - 2026-05-25: Baseline (local
turbo run test:coverage, Node 22):- lms: lines 42.46%, branches 35.29%
- cms: lines 48.03%, branches 37.69%
- portable-text: lines 96.9%, branches 90.62%
- widget-renderers: lines 87.44%, branches 76.81%
- widget-wire-schemas: lines 88.37%, branches 0%
- design-tokens: lines 0% (CSS-only package; no instrumentable TS under
src/beyond tests)