Skip to content

chore: Add shared Vitest coverage config across all packages - #166

Merged
KiwiGaze merged 2 commits into
stagingfrom
chore/shared-vitest-config
Mar 6, 2026
Merged

chore: Add shared Vitest coverage config across all packages#166
KiwiGaze merged 2 commits into
stagingfrom
chore/shared-vitest-config

Conversation

@KiwiGaze

@KiwiGaze KiwiGaze commented Mar 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • Extract shared Vitest coverage configuration into @simplifying/tsconfig/vitest.shared so all packages use identical coverage settings (provider, reporters, include/exclude patterns)
  • Each package's vitest.config.ts now imports and spreads sharedCoverageConfig instead of duplicating settings
  • Add test:coverage task to turbo.json for workspace-wide coverage runs
  • Expand web app coverage includes to also capture .tsx files

Test plan

  • Run pnpm test:run — all existing tests pass
  • Run pnpm test:coverage — coverage runs across all packages via turbo
  • Verify individual package coverage still works (e.g., pnpm --filter @simplifying/task test:coverage)

Summary by CodeRabbit

  • Chores
    • Added test:coverage scripts and a coverage adapter dependency across packages to enable Vitest coverage runs.
    • Introduced a shared coverage configuration to standardize reporting (provider, reporters, include/exclude patterns).
    • Updated build/task configuration to add a top-level coverage task and include the shared config in global dependencies.

Centralize coverage settings in @simplifying/tsconfig/vitest.shared
and spread into each package's vitest.config.ts. Add turbo test:coverage
task for workspace-wide coverage runs.
@coderabbitai

coderabbitai Bot commented Mar 4, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 56778e71-ddea-47f9-98d8-4df57031a8e2

📥 Commits

Reviewing files that changed from the base of the PR and between 676fc5d and 4b767f2.

📒 Files selected for processing (3)
  • packages/api-server/package.json
  • packages/inbox/package.json
  • packages/task/package.json
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/task/package.json
  • packages/api-server/package.json

Walkthrough

Adds a shared Vitest coverage configuration, wires it into package-level Vitest configs, adds test:coverage scripts and @vitest/coverage-v8 devDeps across packages, and registers a turbo task for test:coverage; also expands web coverage patterns to include TSX files.

Changes

Cohort / File(s) Summary
Monorepo root
package.json, turbo.json
Replace root test:coverage to use turbo run test:coverage, add test:coverage:web script, and add a new Turbo task test:coverage with outputs coverage/** and env DATABASE_URL.
Shared config package
packages/tsconfig/package.json, packages/tsconfig/vitest.shared.ts
Add vitest.shared.ts export, mark package as ESM, and introduce sharedCoverageConfig exporting Vitest test.coverage settings (provider v8, reporters, include/exclude globs).
App web
apps/web/package.json, apps/web/vitest.config.ts
Add test:coverage script; expand Vitest coverage include patterns to add .tsx variants.
Packages (scripts & deps)
packages/*/package.json (e.g., packages/api-client/..., packages/api-server/..., packages/errors/..., packages/event/..., packages/inbox/..., packages/job-queue/..., packages/prisma/..., packages/task-group/..., packages/task-sync/..., packages/task/...)
Add test:coverage scripts and add @vitest/coverage-v8 to devDependencies (where applicable).
Packages (Vitest config augmentation)
packages/*/vitest.config.ts (e.g., packages/api-client/..., packages/api-server/..., packages/calendar-sync/..., packages/errors/..., packages/event/..., packages/inbox/..., packages/job-queue/..., packages/prisma/..., packages/task-group/..., packages/task-sync/..., packages/task/...)
Import and spread sharedCoverageConfig into each package's Vitest defineConfig test object (minor alias/comment cleanups in some files).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 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 'chore: Add shared Vitest coverage config across all packages' directly and comprehensively describes the main objective of the changeset: extracting shared Vitest coverage configuration and applying it across all packages.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Peer Dependency Consistency ✅ Passed PR does not modify any peerDependencies in any package.json files; no peer dependency consistency issues detected.
Api Contract Layer Conventions ✅ Passed The custom check for API contract layer conventions applies only to new or modified Next.js API route handlers, which this PR does not modify.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/shared-vitest-config

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/api-server/package.json`:
- Line 19: Update the "test:coverage" npm script in package.json to include the
--passWithNoTests flag so it behaves like the other test scripts; locate the
"test:coverage" entry and append --passWithNoTests to the existing command
("vitest run --coverage") ensuring the script becomes "vitest run --coverage
--passWithNoTests" to avoid non-zero exit codes when no tests are present.

In `@packages/inbox/package.json`:
- Line 20: The "test:coverage" npm script in package.json omits the
--passWithNoTests flag; update the "test:coverage" script entry (script name
"test:coverage") to include --passWithNoTests so it matches "test" and
"test:run" and will succeed even when no tests exist, ensuring consistency
across scripts.

In `@packages/task/package.json`:
- Around line 19-20: The test:coverage npm script currently runs "vitest run
--coverage" which fails with exit code 1 when no tests exist; update the
"test:coverage" script in package.json to include the --passWithNoTests flag
(making it mirror "test:run") so it becomes "vitest run --coverage
--passWithNoTests", ensuring workspace coverage runs don't fail for packages
without tests.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4c2a0dac-a41f-40b9-9340-bdafaa71ea0a

📥 Commits

Reviewing files that changed from the base of the PR and between d6c1ec2 and 676fc5d.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !**/pnpm-lock.yaml
📒 Files selected for processing (28)
  • apps/web/package.json
  • apps/web/vitest.config.ts
  • package.json
  • packages/api-client/package.json
  • packages/api-client/vitest.config.ts
  • packages/api-server/package.json
  • packages/api-server/vitest.config.ts
  • packages/calendar-sync/package.json
  • packages/calendar-sync/vitest.config.ts
  • packages/errors/package.json
  • packages/errors/vitest.config.ts
  • packages/event/package.json
  • packages/event/vitest.config.ts
  • packages/inbox/package.json
  • packages/inbox/vitest.config.ts
  • packages/job-queue/package.json
  • packages/job-queue/vitest.config.ts
  • packages/prisma/package.json
  • packages/prisma/vitest.config.ts
  • packages/task-group/package.json
  • packages/task-group/vitest.config.ts
  • packages/task-sync/package.json
  • packages/task-sync/vitest.config.ts
  • packages/task/package.json
  • packages/task/vitest.config.ts
  • packages/tsconfig/package.json
  • packages/tsconfig/vitest.shared.ts
  • turbo.json

Comment thread packages/api-server/package.json Outdated
Comment thread packages/inbox/package.json Outdated
Comment thread packages/task/package.json Outdated
@KiwiGaze
KiwiGaze merged commit 0ccedde into staging Mar 6, 2026
5 checks passed
@KiwiGaze
KiwiGaze deleted the chore/shared-vitest-config branch March 6, 2026 11:03
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