Skip to content

feat(ci): add vitest code coverage analysis#32

Merged
priyanshus merged 4 commits into
Evaliphy:mainfrom
quanticsoul4772:rawcell/add-code-coverage-20
Apr 20, 2026
Merged

feat(ci): add vitest code coverage analysis#32
priyanshus merged 4 commits into
Evaliphy:mainfrom
quanticsoul4772:rawcell/add-code-coverage-20

Conversation

@quanticsoul4772

Copy link
Copy Markdown
Contributor

Summary

Resolves #20.

  • Add vitest.config.ts at root with @vitest/coverage-v8 provider, text/lcov/html reporters, workspace package aliases, and minimum thresholds (60% lines/functions/statements, 50% branches)
  • Add @vitest/coverage-v8 to root devDependencies
  • Add test:coverage script (vitest run --coverage)
  • Update test.yml GitHub Actions workflow: run test:coverage after test, upload coverage/ as a 30-day artifact

Test plan

  • pnpm run test:coverage runs without error and emits coverage summary
  • coverage/ directory created with index.html and lcov.info
  • GitHub Actions Coverage step uploads the artifact on PRs to main
  • Coverage thresholds fail the build if they drop below 60%/50%

🤖 Generated with Claude Code

Resolves Evaliphy#20. Adds coverage reporting via @vitest/coverage-v8:

- vitest.config.ts: new root config with coverage provider (v8),
  reporters (text/lcov/html), package alias resolution, and
  minimum thresholds (60% lines/functions/statements, 50% branches)
- package.json: add @vitest/coverage-v8 devDependency; add
  test:coverage script (vitest run --coverage)
- test.yml: add Coverage step after Test; upload coverage/ as a
  workflow artifact retained for 30 days

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel

vercel Bot commented Apr 18, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the priyanshus's projects Team on Vercel.

A member of the Team first needs to authorize it.

@priyanshus

Copy link
Copy Markdown
Collaborator

@quanticsoul4772 Thanks for the PR. Can you please check why tests are failing.

@quanticsoul4772

Copy link
Copy Markdown
Contributor Author

Tests aren't actually running, CI fails at the install step:
Code
The PR added @vitest/coverage-v8 to devDependencies but the lockfile wasn't regenerated. Fix is one commit: pnpm install locally, then commit the updated pnpm-lock.yaml. Pushing that now.

The parent commit added @vitest/coverage-v8 to devDependencies but did
not update the lockfile, so CI's `pnpm install --frozen-lockfile` failed
with ERR_PNPM_OUTDATED_LOCKFILE. Verified `pnpm install --frozen-lockfile`
now succeeds locally.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@quanticsoul4772

Copy link
Copy Markdown
Contributor Author

@priyanshus The failing check was the install step, not the tests — CI rejected pnpm install --frozen-lockfile because the lockfile didn't include the new @vitest/coverage-v8 specifier:

ERR_PNPM_OUTDATED_LOCKFILE  Cannot install with "frozen-lockfile"
because pnpm-lock.yaml is not up to date with <ROOT>/package.json

Pushed 6f2ec62 — regenerated pnpm-lock.yaml via pnpm install (pnpm 9.15.9, matching CI). Verified pnpm install --frozen-lockfile now passes locally.

Orthogonal note (not caused by this PR): package.json declares "engines": { "node": ">=24.0.0" } but CI pins node-version: 20 in .github/workflows/test.yml. The install currently works because pnpm treats the engines field as a warning rather than a hard constraint, but the warning will show up on every run. Worth bumping the CI matrix to Node 24 separately if you want a clean log.

Lines/statements/branches were set above actual measured coverage
(55.32% / 54.21% / 46.39%), causing CI to fail. Set floors just below
actuals so the check acts as a regression guard rather than a blocker.
Raise thresholds as coverage improves.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@quanticsoul4772

Copy link
Copy Markdown
Contributor Author

Pushed 6439b83 — lowered coverage thresholds to match current baseline.

CI failure cause: The thresholds I set (lines: 60%, statements: 60%, branches: 50%) were above actual measured coverage. CI reported:

  • Lines: 55.32% vs 60% threshold → FAIL
  • Statements: 54.21% vs 60% threshold → FAIL
  • Branches: 46.39% vs 50% threshold → FAIL

Fix: Thresholds now set just below actuals to act as a regression floor:

  • lines: 54% (actual: 55.32%)
  • statements: 53% (actual: 54.21%)
  • branches: 44% (actual: 46.39%)
  • functions: 60% (unchanged, was already passing)

These values prevent coverage regressions without blocking CI on the existing codebase. Comments in the config note they should be raised as coverage improves.

@priyanshus

Copy link
Copy Markdown
Collaborator

@quanticsoul4772 Approved PR. Please merge it after resolving conflicts.

Thanks!

Resolve conflicts with main's parallel coverage commit (76e63f4, PR Evaliphy#40):
- vitest.config.ts: keep monorepo-aware config with package aliases and
  regression-floor thresholds (lines 54, statements 53, branches 44,
  functions 60) per the approved design on this PR.
- .github/workflows/test.yml: keep separate Test and Coverage steps and
  30-day artifact retention.
- pnpm-lock.yaml: regenerated via pnpm install, verified with
  --frozen-lockfile.

Verified: pnpm run test:coverage passes (102 tests) with coverage above
configured thresholds.
@quanticsoul4772

Copy link
Copy Markdown
Contributor Author

@priyanshus conflicts resolved in e3c2134. CI test passed (26s, 102 tests). My account doesn't have merge permission on the repo, so the merge button is yours.

@priyanshus priyanshus merged commit 69def73 into Evaliphy:main Apr 20, 2026
1 of 2 checks passed
@quanticsoul4772 quanticsoul4772 deleted the rawcell/add-code-coverage-20 branch April 20, 2026 14:13
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.

Code coverage analysis

2 participants