test: add Vitest, Codecov CI, and unit test suite (511 tests)#8
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MPNextinto this pnpm monorepo (vitest.config.ts,src/test-setup.ts,test/test:run/test:coveragescripts)..github/workflows/test.ymlto run tests on push/PR tomainand uploadcoverage/coverage-final.jsonto Codecov (fail_ci_if_error: false, token viasecrets.CODECOV_TOKEN).What's tested
src/lib/embed(jwt, auth, config, recaptcha)src/services(6 service singletons)src/lib/providers/ministry-platform(client, helper, provider, http-client, auth, 6 sub-services)packages/embed-sdk/src/shared(api-client, cdn-loader, base-widget)packages/types/src(5 Zod schema files + index)Action required (post-merge)
CODECOV_TOKENto Settings → Secrets and variables → Actions so the CI job can upload coverage. The workflow is set tofail_ci_if_error: false, so the build stays green if the token is missing or Codecov is unreachable.Test plan
pnpm test:coveragelocally → 30 files, 511 tests, all passing in ~4.2spnpm install --frozen-lockfile, executespnpm test:coverage, and uploads coverage (or skips silently ifCODECOV_TOKENis not yet configured)🤖 Generated with Claude Code