Skip to content

chore: add test coverage measurement - #3362

Merged
jeanfbrito merged 1 commit into
masterfrom
chore/coverage-measurement
Jun 22, 2026
Merged

chore: add test coverage measurement#3362
jeanfbrito merged 1 commit into
masterfrom
chore/coverage-measurement

Conversation

@jeanfbrito

@jeanfbrito jeanfbrito commented Jun 22, 2026

Copy link
Copy Markdown
Member

What

Wires test coverage collection and reporting to establish a baseline. Measurement only — no threshold gate, so coverage never blocks a merge.

Starting coverage (baseline)

Measured locally with the new yarn test:coverage (282 pass, 2 skip):

Metric Coverage
Statements 17.67% (1929/10911)
Branches 13.18% (676/5128)
Functions 11.87% (272/2290)
Lines 17.15% (1749/10195)

The denominator includes currently-untested directories (src/store/, src/ipc/, src/logging/, etc.), so this is a real coverage figure, not a tested-files ratio.

Changes

  • jest.config.js — root-level collectCoverageFrom across src/**/*.{ts,tsx} (excludes specs, .d.ts, .jest, public); reporters text-summary + lcov + json-summary; output to coverage/. No coverageThreshold — deliberate.
  • package.json — adds test:coverage (same flags as test + --coverage). test left untouched so the default path stays fast.
  • .github/workflows/validate-pr.yml — runs yarn test:coverage; uploads coverage/ as an artifact (Linux-only, always(), non-blocking).
  • .gitignore — ignores /coverage.

Notes

  • Coverage instrumentation verified working under @kayahr/jest-electron-runner (both main + renderer projects) — no v8 fallback needed.
  • Artifact upload chosen over Codecov to avoid requiring a CODECOV_TOKEN secret. Swap to codecov-action later if inline PR deltas / trend graphs are wanted.

Follow-ups (out of scope here)

  • Add tests for pure-logic quick wins (store/, ipc/, logging/privacy, utils/versionUtils, navigation reducers).
  • Once the baseline lands, add a coverageThreshold floor and ratchet it up per PR.

Summary by CodeRabbit

  • Tests

    • Implemented automated code coverage reporting in the continuous integration pipeline.
  • Chores

    • Updated test configuration to collect and track code coverage metrics during validation.

Wire coverage collection, reporting, and a non-failing CI signal to
establish a baseline. No threshold gate — coverage never blocks merge.

- jest.config.js: root-level collectCoverageFrom across src/**, with
  text-summary/lcov/json-summary reporters
- package.json: add test:coverage script (test left untouched)
- validate-pr.yml: run test:coverage, upload coverage/ as artifact
  (Linux-only, non-blocking)
- .gitignore: ignore /coverage

Baseline: 17.15% lines, 17.67% statements, 13.18% branches,
11.87% functions (282 pass, 2 skip).
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cae4eeb4-0e14-4ca0-b460-8f9c02a4f159

📥 Commits

Reviewing files that changed from the base of the PR and between 4856b6b and 6da8330.

📒 Files selected for processing (4)
  • .github/workflows/validate-pr.yml
  • .gitignore
  • jest.config.js
  • package.json
📜 Recent review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: check (ubuntu-latest)
  • GitHub Check: check (macos-latest)
  • GitHub Check: check (windows-latest)
🔇 Additional comments (4)
jest.config.js (1)

2-12: LGTM!

package.json (1)

44-44: LGTM!

.github/workflows/validate-pr.yml (1)

44-51: LGTM!

.gitignore (1)

28-28: LGTM!


Walkthrough

Adds Jest code coverage configuration (collectCoverageFrom, coverageReporters, coverageDirectory, coveragePathIgnorePatterns) and a test:coverage npm script. The CI validation workflow is updated to run yarn test:coverage and upload the coverage/ directory as a workflow artifact. The /coverage directory is added to .gitignore.

Changes

Coverage Reporting Setup

Layer / File(s) Summary
Jest coverage config and test:coverage script
jest.config.js, package.json
jest.config.js gains collectCoverageFrom targeting src/**/*.{ts,tsx} with exclusions, plus coverageReporters, coverageDirectory, and coveragePathIgnorePatterns. package.json adds a test:coverage script that runs Jest with --coverage and the same flags as the existing test script.
CI workflow and .gitignore integration
.github/workflows/validate-pr.yml, .gitignore
The validate-pr workflow replaces yarn test with yarn test:coverage and appends an artifact upload step for coverage/ (ubuntu-latest only, always() condition, warn-if-empty). /coverage is added to .gitignore.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Suggested labels

type: chore

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding test coverage measurement infrastructure to the project.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@jeanfbrito
jeanfbrito merged commit 96b1de4 into master Jun 22, 2026
9 checks passed
@jeanfbrito
jeanfbrito deleted the chore/coverage-measurement branch June 22, 2026 16:23
jeanfbrito added a commit that referenced this pull request Jun 22, 2026
Append-only log of coverage milestones (date, PR, the four metric
percentages, test count, notes) plus how to measure + update it and
the testing gotchas learned while building the suite. Records the
17.15% -> 33.29% climb across PRs #3362-#3366.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant