Skip to content

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.

Terminal window
pnpm test

This runs the unit tests of every package. Vitest does not check types, so run pnpm typecheck as well.

Terminal window
pnpm --filter @dfa/api exec vitest run --project unitaire apps/api/src/facturation/documents/numerotation.spec.ts

To run a single test by name, add -t with a fragment of the name:

Terminal window
pnpm --filter @dfa/api exec vitest run --project unitaire -t "fragment of the name" apps/api/src/facturation/documents/numerotation.spec.ts

The web package has no --project flag:

Terminal window
pnpm --filter @dfa/web exec vitest run apps/web/src/test/accessibilite/contraste-jetons.spec.ts
Terminal window
pnpm test:integration

The 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.

Terminal window
scripts/verifier-reversibilite-migrations.sh

The 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.

  • 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.