test-first
Test-first conventions: test names are sentences, no mocks for code we own, real DB in integration tests.
npx rulepack add test-first
What it covers
- Test-first workflow: reproduce a regression with a failing test first; for new features start from the smallest end-to-end test and iterate inward
- A three-layer test pyramid — fast unit tests (no I/O), integration tests for the seam between your code and external systems, and a few end-to-end tests against the real stack
- Behaviour-focused test names (
it("rejects expired tokens"), notit("calls verifyJwt")) with one assertion per behaviour - No mocking code you own and no mocking the database — use a real test DB with transactional rollback per test
- Snapshots only for stable, semantic outputs (never deep JSON with timestamps/IDs), always reviewed in PR; coverage treated as a smell detector, not a target
Based on
Established test-first / TDD practice — tests as executable specifications, real collaborators over mocks, integration tests against real infrastructure.
License
MIT