Test dmsforall
At the end of this page, you can run the whole test suite, a single test file, and the integration tests on a throwaway database.
Unit tests
Section titled “Unit tests”pnpm testThis runs the unit tests of every package. Vitest does not check types, so run pnpm typecheck as well.
One test file
Section titled “One test file”pnpm --filter @dfa/api exec vitest run --project unitaire apps/api/src/facturation/documents/numerotation.spec.tsTo run a single test by name, add -t with a fragment of the name:
pnpm --filter @dfa/api exec vitest run --project unitaire -t "fragment of the name" apps/api/src/facturation/documents/numerotation.spec.tsThe web package has no --project flag:
pnpm --filter @dfa/web exec vitest run apps/web/src/test/accessibilite/contraste-jetons.spec.tsIntegration tests
Section titled “Integration tests”pnpm test:integrationThe integration tests start a throwaway PostgreSQL database with testcontainers. Docker must be running. They never use your development database.
The integration tests need the mdbtools programs for the Access archive tests. The CI installs them. Install them locally to run the full set.
Migration reversibility
Section titled “Migration reversibility”scripts/verifier-reversibilite-migrations.shThe script applies each migration, reverts it with its reverse script, and applies it again. CI runs it on every change. A migration that cannot be reverted fails the check.
Test rules
Section titled “Test rules”- Tenant isolation, arithmetic on money, state machines and the role by action matrix must have tests.
- Money tests check exact values, never approximations.
- An integration test checks the real query, not a mock of the database layer.
- Never weaken a test to make it pass. Fix the code, or change the test with a reason that the review accepts.