Unit Testing with Vitest in MakerKit
Run and write unit tests with the Vitest setup used by the current monorepo.
Unit tests live across packages and run through Vitest.
Run Tests
All unit tests:
pnpm test:unitSingle package:
pnpm --filter @kit/rbac test:unitpnpm --filter @kit/database test:unitWatch mode is only available in packages that define test:unit:watch:
pnpm --filter @kit/rbac test:unit:watchCoverage
There is no repo-wide test:unit:coverage convention. If you need coverage for a package, run Vitest directly for that package.
Where Tests Live
Tests usually sit near the code they cover, for example:
packages/rbac/src/core/__tests__/packages/database/src/services/packages/organization/core/src/services/__tests__/Good Candidates
- pure functions
- service logic
- schema validation
- RBAC and policy behavior
- database helpers and test utilities