testing-philosophy
Installation
SKILL.md
Testing Philosophy
Overview
This developer's personal testing standards, independent of stack or test runner (examples use Vitest, but every rule ports directly to Jest/pytest/etc.). Two concerns, kept separate: what makes a test worth keeping (this file) and when tests run at all (Execution Timing below) — conflating them leads to either skipping coverage that's actually required, or running tests at points in the workflow where they just add noise.
Quick Reference
| Concern | Rule |
|---|---|
| What layers get unit tests | Business-logic services — yes. Components, repositories, thin API-client wrappers, pure mappers — no (see table below) |
| Coverage shape | Happy path AND negative/failure/validation branches — not happy-path-only |
| Assertion style | toHaveBeenCalledWith/toHaveBeenNthCalledWith — never index into mock.calls[n][m] |
| Logger/console | Never assert on it — assert the observable behavior around it instead |
| The tautology check | If the test still passes with the method body replaced by return mockResult, delete it |
| Who writes tests | A separate pass/agent from the one that wrote the production code — not bundled into the same task |
| When tests run | Only on explicit request, after all planned code changes in the task are done — never automatically after an edit |