Skip to content

test(coverage): add vitest + pytest coverage with Codecov reporting - #277

Open
winlp4ever wants to merge 1 commit into
mainfrom
feat/test-coverage-codecov
Open

test(coverage): add vitest + pytest coverage with Codecov reporting#277
winlp4ever wants to merge 1 commit into
mainfrom
feat/test-coverage-codecov

Conversation

@winlp4ever

Copy link
Copy Markdown
Contributor

What

Adds code-coverage measurement to the two unit test suites and reports it on every PR via Codecov.

Suite Tool Output
webui (vitest) @vitest/coverage-v8 webui/coverage/lcov.info
backend (pytest) pytest-cov backend/coverage.xml

Baselines from local runs: webui ~27% lines, backend ~55% lines/branch.

Changes

  • webui: @vitest/coverage-v8 dev dep, coverage block in vitest.config.ts (v8 provider, text + lcov), test:cov script.
  • backend: pytest-cov dev dep, [tool.coverage.run]/[tool.coverage.report] in pyproject.toml (branch coverage, source=topix).
  • Makefile: test-ui-cov, test-backend-cov.
  • CI (tests.yml): webui + backend jobs now run the coverage targets and upload to Codecov under per-suite flags (webui, backend). fail_ci_if_error: false so an upload hiccup never blocks a PR.
  • codecov.yml: statuses are informational (report + comment, never block merges), PR comment shows diff coverage. Tests/e2e are excluded from the denominator.

⚠️ Required before this works: add the Codecov secret

Codecov needs a token for this repo:

  1. Sign in at codecov.io with GitHub and add the vcmf/dim0 repo.
  2. Copy its Repository Upload Token.
  3. In GitHub: Settings → Secrets and variables → Actions → New repository secret, name CODECOV_TOKEN, paste the value.

Until the secret exists, the upload steps no-op (they won't fail the build). The tauri/e2e jobs are unaffected.

Notes / follow-ups

  • Non-blocking by design — you'll see numbers and PR comments but coverage never fails a merge. To make it a gate later: flip informational: true → false in codecov.yml and set a target.
  • The webui/package-lock.json churn is from @vitest/coverage-v8 + its istanbul/v8 transitive deps only (resolved with npm 11 to avoid an npm-10 solver bug on this tree); no unrelated packages changed.

🤖 Generated with Claude Code

Wire code coverage for the two unit suites and report it on PRs.

- webui: add @vitest/coverage-v8, coverage config in vitest.config.ts,
  and a test:cov script (v8 provider, text + lcov reporters).
- backend: add pytest-cov and [tool.coverage] config (branch coverage,
  source=topix); emit coverage.xml.
- Makefile: test-ui-cov / test-backend-cov targets.
- CI: run the suites with coverage and upload to Codecov under per-suite
  flags (webui, backend); fail_ci_if_error is off so an upload hiccup
  never blocks a PR.
- codecov.yml: informational (non-blocking) statuses + PR diff-coverage
  comment. Requires a CODECOV_TOKEN repo secret.
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.

1 participant