I’ve seen teams heavily invest in one type of test while leaving the biggest sources of bugs untouched.
In frontend development, not all bugs live in the same layer.
Some hide deep in the logical layer - functions, date manipulation, and pure calculations. Others appear only when different parts of the system come together. And then there are the purely visual issues that break the experience without breaking the logic.
The problem?
Many teams default to writing lots of unit tests because they’re quick, easy to run, feel productive and have the dopamine hit when everything is green. But while these tests are perfect for logic-heavy modules, they often miss the problems that users actually encounter.
After spiking testing strategies across multiple projects, one pattern stood out to me:
That insight changed everything.
I realised that testing effort should follow bug likelihood, not just habit.
Here’s the strategy that’s given us both efficiency and confidence:
The result?
Most bugs are caught before they hit production, and we don’t waste days writing tests that don’t match where problems actually occur.
We stopped thinking of tests as ‘covering files’ and started thinking about them as protecting behaviours, now we ask ourself what actions can break that test and trying to cover as much as possible in the integration level. For the visuals, we defer it to the design system visual regression snapshots.
By testing the way users experience the application - and still covering our logic-heavy utilities - we’ve built a safety net that’s both lean and trustworthy.
Testing is not about writing the most tests. It’s about balance it’s about writing the right type of tests in the right place.
Shouldn’t we just test everything with integration tests?
Not quite - you get a faster feedback loop, and it’s easier to validate with isolated unit tests if a logical test works as intended. Often times the integration tests are mocked, so you don’t really get the real end-to-end experience. Integration tests shine when verifying flows, form submissions and user interactions.
Why not do more visual regression?
They’re powerful, but slow and expensive to run. Use them where visual consistency matters most.
Sat, 19 April 2025
How To Actually Test Your Frontend Code
Writing tests on the frontend that matter is hard. What exactly to test can feel a bit mysterious and can lead to bad practices of either test the wrong things or testing less critical stuff on the page
Thu, 17 April 2025
Why I Stopped Obsessing Over 100% Unit Test Coverage
Our CI pipelines required 100% coverage. Here's how it backfired and what I now focus on instead.
Sun, 10 August 2025
React Hooks: A Practical Guide for Real-World Frontend Development
React hooks simplify state and side-effect management, but they're also easy to misuse. Here's a practical guide to mastering hooks in real-world projects, without falling into common traps.
Subscribe to get updates on new blog posts, useful frontend tips and ideas you can apply in your own work.