Test strategy Required
Shape the test suite like a pyramid
Write many small, fast tests and only a few slow, wide ones. Each kind of test checks what only it can check.
How to do it
Unit tests cover rules and calculations. Integration tests cover how your code talks to a database or another service. Browser tests cover a few whole journeys. When a slow test only checks logic, move that check down to a unit test. Keep the whole suite under a set time, such as 10 minutes.
Example
# Count tests by folder, then time the whole run
find tests/unit -name '*.test.*' | wc -l
find tests/integration -name '*.test.*' | wc -l
find tests/e2e -name '*.spec.*' | wc -l
time npm test
How to check
Count tests by kind. Unit tests outnumber integration tests, which outnumber browser tests. The full suite runs in under ten minutes.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers testing playbook: https://agentwranglers.se/playbook/testing/test-strategy/test-shape.