There are many libraries and combinations of these libraries that you can use for bare bones React Testing:
The last three months, I worked with one larger client of mine and we settled on only using Jest for testing React components (1). It went surprisingly well and I would do it again for my next projects. Sometimes there is no need to throw yet another library on top of it.
However, if you are looking for more conveniences, testing React with Enzyme (2) or RTL (3) gives you more abstractions on top. But again, your whole development team needs to adjust to yet another testing library.
If you are coming from Node.js, testing your React components with Mocha/Chai/Sinon (4) may be more familiar to you. That’s how I learned testing frontend applications at least; but times have changed and thus I think the other solutions are more popular now.
Regardless of which solution you pick, throwing Cypress on top for E2E Testing isn’t a bad idea. Especially if you are working on more complex user interactions and/or larger web applications, it saves you lots of time in the aftermath, because you don’t have to do much manual testing for every deployment anymore. Read more about
testing React with Cypress.
In one of my last projects, the PM enforced a testing coverage of 95%. Generally, I don’t agree with a threshold as high as 95%, but then again I just shifted my perspective on things and took it as opportunity to learn more about testing. Read more about
setting up a CI +
Test Coverage.
If you are like me and you want to double down on a simple renderer + Jest for testing React applications, you may enjoy these tutorials to boost your Jest knowledge: