Skip to content

test: add Vitest, Codecov CI, and unit test suite (511 tests)#8

Merged
chriskehayias merged 1 commit into
mainfrom
chore/add-vitest-codecov-test-suite
May 17, 2026
Merged

test: add Vitest, Codecov CI, and unit test suite (511 tests)#8
chriskehayias merged 1 commit into
mainfrom
chore/add-vitest-codecov-test-suite

Conversation

@chriskehayias
Copy link
Copy Markdown
Contributor

Summary

  • Port the Vitest + v8 coverage setup from the sister repo MPNext into this pnpm monorepo (vitest.config.ts, src/test-setup.ts, test/test:run/test:coverage scripts).
  • Add .github/workflows/test.yml to run tests on push/PR to main and upload coverage/coverage-final.json to Codecov (fail_ci_if_error: false, token via secrets.CODECOV_TOKEN).
  • Add 511 unit tests across 30 files (93.76% statements / 95.13% functions on the tested surface).

What's tested

Area Files Tests
src/lib/embed (jwt, auth, config, recaptcha) 4 50
src/services (6 service singletons) 6 67
src/lib/providers/ministry-platform (client, helper, provider, http-client, auth, 6 sub-services) 11 201
packages/embed-sdk/src/shared (api-client, cdn-loader, base-widget) 3 42
packages/types/src (5 Zod schema files + index) 6 151

Action required (post-merge)

  • Add CODECOV_TOKEN to Settings → Secrets and variables → Actions so the CI job can upload coverage. The workflow is set to fail_ci_if_error: false, so the build stays green if the token is missing or Codecov is unreachable.

Test plan

  • pnpm test:coverage locally → 30 files, 511 tests, all passing in ~4.2s
  • CI run on this PR confirms the workflow installs deps via pnpm install --frozen-lockfile, executes pnpm test:coverage, and uploads coverage (or skips silently if CODECOV_TOKEN is not yet configured)

🤖 Generated with Claude Code

Mirrors the test setup from sister repo MPNext: Vitest + v8 coverage,
jsdom env, shared test-setup with stubbed env vars, and a GitHub Actions
workflow that runs on push/PR to main and uploads coverage-final.json to
Codecov (token from secrets.CODECOV_TOKEN, fail_ci_if_error: false).
Adapted the workflow for this repo's pnpm monorepo via pnpm/action-setup.

Adds 511 tests across 30 files covering services, lib/embed auth/JWT/CORS,
the Ministry Platform provider stack (helper, provider, client, http-client,
client-credentials, table/procedure/metadata/domain/communication/file
services), embed-SDK shared utilities (api-client, cdn-loader, base-widget),
and all @mpnext/types Zod schemas. Coverage: 93.76% statements / 95.13%
functions on the tested surface.

Action item: add CODECOV_TOKEN to the repo's GitHub Actions secrets to
enable coverage uploads from CI.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@chriskehayias chriskehayias merged commit e50d595 into main May 17, 2026
1 check failed
@chriskehayias chriskehayias deleted the chore/add-vitest-codecov-test-suite branch May 17, 2026 18:45
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