The Bugs I Care About Usually Live Between Layers
Component tests are useful, but the failures that hurt most often happen where permissions, persistence, contracts and browser flows meet.
Key takeaways
Tests are most valuable around boundaries where responsibility changes.
Use the smallest test that can actually prove the behavior.
Coverage helps find gaps, but it does not tell you whether the important behavior is protected.
Where I have been burned
A green component test can still hide a broken product flow.
A button can hide correctly while the API still accepts the forbidden action. A persistence hook can pass while refresh restores the wrong state. Two apps can compile against the same type and still interpret a transition differently.
Those failures sit between owners. That is why I spend more time thinking about seams than trying to maximize the number of isolated component tests.
Pick the right level
I do not want an end-to-end test for every rule.
Pure GST, inventory and validation rules are faster to prove with unit tests. Component tests are good for interaction and accessible output. Repository or API boundaries deserve integration-style coverage. Browser tests are for the journeys that need a real browser.
Using one test type for everything either makes feedback painfully slow or leaves important boundaries untested.
- Unit: deterministic business rules.
- Component: behavior a user can interact with.
- Integration: API, repository and contract boundaries.
- E2E: critical user journeys and browser behavior.
Tests are most valuable around boundaries where responsibility changes.
About coverage
I use coverage as a warning light, not a score.
A percentage is useful when it points me to an area I forgot to exercise. It is not proof that the important scenario is covered.
One untested authorization branch can matter more than a hundred harmless presentation lines. I care more about the cost of a failure than the raw number of executed lines.
Coverage tells me where to look. The test scenario tells me whether I should feel confident.
Tests are most valuable around boundaries where responsibility changes.
A design signal
Painful tests often expose unclear ownership.
If I need to mount half the application to test one calculation, the calculation probably lives in the wrong place. If every test repeats the same network mocks, I probably need a better adapter boundary.
That is why I treat testing as architecture feedback, not just something to run before a merge.
Tests are most valuable around boundaries where responsibility changes.