Skip to content

feat: add code coverage setup with Codecov integration and GitHub badge#369

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/evaluate-code-coverage-setup
Draft

feat: add code coverage setup with Codecov integration and GitHub badge#369
Copilot wants to merge 2 commits intomainfrom
copilot/evaluate-code-coverage-setup

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 8, 2026

No code coverage reporting infrastructure existed despite having a unit:test:coverage script — no thresholds, no CI upload, no badge.

Description

Sets up Jest coverage collection, enforces thresholds, uploads reports to Codecov on every CI run, and surfaces coverage via a README badge.

What change does this PR introduce?

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update (changes to docs/code comments)

What is the proposed approach?

jest.config.js — Coverage configuration added:

  • collectCoverageFrom: scopes to src/**/*.{ts,tsx}, excluding dev/entry-point files (App.tsx, devIndex.tsx, index.tsx, viteconfig.ts, *.d.ts)
  • coverageReporters: ['text', 'lcov', 'json-summary']: console output + lcov for Codecov + json-summary for tooling
  • coverageThreshold: CI fails if coverage drops below these measured-and-conservative baselines:
coverageThreshold: {
  global: {
    statements: 75,  // current ~79.3%
    branches: 55,    // current ~61.1%
    functions: 65,   // current ~74.1%
    lines: 75,       // current ~79.1%
  },
}

codecov.yml — Codecov project config:

  • Project target ≥75% (2% drop tolerance), patch target ≥70% (5% tolerance)
  • PR comments showing diff/flags/files breakdown
  • unit flag scoped to src/

.github/workflows/test.yml — CI changes:

  • npm run unit:testnpm run unit:test:coverage to generate the lcov report
  • Uploads ./coverage/lcov.info via codecov/codecov-action@v5 with the unit flag
  • CODECOV_TOKEN secret forwarded through workflow_call

.github/workflows/lint-and-build.yml — Passes CODECOV_TOKEN secret to the reusable test workflow.

README.md — Codecov badge added next to the CI badge.

Setup required: Add CODECOV_TOKEN as a GitHub Actions secret after connecting the repo at codecov.io (free for open source).

On the "monorepo / multi-stack" question: this repo has two test stacks (Jest unit + Cypress e2e). The industry-standard approach is to upload each as a separate flagged report to Codecov, which merges them into a unified view. This PR covers the Jest side. Cypress coverage (via @cypress/code-coverage) can be added as a follow-up with an integration flag.

Checklist:

  • The commit message follows our adopted guidelines
  • Testing has been done for the change(s) added (for bug fixes/features)
  • Relevant comments/docs have been added/updated (for bug fixes/features)

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • download.cypress.io
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node dist/index.js --exec install (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Research code coverage setup for monorepo feat: add code coverage setup with Codecov integration and GitHub badge Apr 8, 2026
Copilot AI requested a review from tjtanjin April 8, 2026 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants