Skip to content

Add code coverage gate (>= 85%) to GitHub Actions CI #6

Description

@bjinwright

Problem/Overview

The project has Mocha unit tests and c8 coverage tooling (npm run test:unit:coverage), but there is no Continuous Integration. Coverage is never enforced, so regressions in test coverage can land silently.

We want a GitHub Actions workflow that runs the unit test suite with coverage on every push to main and every pull request targeting main, and fails the build when code coverage drops below 85%. The workflow should also surface the coverage report so reviewers can inspect it.

Acceptance Criteria

  • A GitHub Actions workflow exists at .github/workflows/ that runs on push to main and on pull requests targeting main.
  • The workflow installs dependencies and runs the unit test suite with c8 coverage on a Node 20 LTS runner.
  • Coverage is enforced via c8 --check-coverage: the job fails when lines, statements, functions, or branches coverage is below 85%.
  • The 85% thresholds are configured in a committed c8 config file (.c8rc.json) so local and CI runs use the same gate.
  • When coverage meets or exceeds 85%, the workflow passes; when it falls below 85% on any metric, the workflow fails with a clear message in the logs.
  • The HTML coverage report is uploaded as a workflow artifact for inspection.

Notes

  • PRs for this issue must include a closing keyword in the PR body (e.g. Closes #{number}); use Partially addresses #{number} for intermediate PRs and reserve Closes #{number} for the final PR so the issue auto-closes on merge.
  • Assumptions (user skipped clarifications): gate all four c8 metrics at 85%; triggers = push to main + PRs to main; scope = unit tests only; reporting = fail build + upload HTML artifact; single Node 20 LTS runner.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions