Should I have Jest unit tests outside Storybook if I already use Storybook testing?

I am working on a React project where we are using Storybook for UI component development. Storybook also provides testing capabilities such as interaction tests (via @storybook/testing-library) and visual regression testing (via @storybook/addon-visual-tests or tools like Chromatic).

However, we are also considering writing unit tests separately using Jest and React Testing Library outside Storybook. This raises a few concerns:

Is having Jest tests outside Storybook redundant if we already test in Storybook? If not redundant, when should we use Jest, and when should we use Storybook-based tests? Which approach is generally recommended for testing UI components in a well-maintained React project? We want to maintain good test coverage while keeping the setup efficient and not duplicating efforts unnecessarily. Any best practices or recommendations would be helpful!

We expected Storybook tests to cover most of our UI scenarios, but we're unsure if we still need Jest unit tests for components. We are trying to determine if keeping Jest tests is necessary or if we are duplicating efforts by testing the same things twice.

Upvotes: 0

Views: 20

Answers (0)

Related Questions