I've been maintaining a design system and I keep asking myself why we're writing 300 integration tests for components that could be tested in 20 unit tests. Integration tests are slow, flaky, and require Docker Compose. They feel like insurance against problems we don't actually have.
Unit tests catch real bugs. E2E tests catch real user pain. Integration tests mostly catch the fact that our mocks are out of sync with reality, which tells me our abstraction is wrong.
For component libraries, I'm pretty convinced now that unit tests (with some well-placed snapshot tests for rendering) plus targeted E2E flows is the move. Skip the middle layer. Your test suite runs in seconds instead of minutes and you're not maintaining three different test databases.
Maybe there's a sweet spot for integration tests in backend services. But for frontend code, I think we cargo-culted this from testing frameworks that needed it.
Anyone actually shipping products that couldn't live without integration tests?
No responses yet.