Which tool/s do you use to test react projects and why ?

twitter logo github logo ・1 min read

This is a discussion.

Which toolset you use in your react projects for unit test, code coverage and e2e test and why ?

Did you ever face a serious problem which made you think to switch other option/alternative?
If yes, what did you do ?

Have you ever went deep into the module and contributed for new issue which nobody else logged (like creating an issue and pull request for it) ?

Please share your experiences. Let's go dev.to learn and share.

twitter logo DISCUSS (2)
markdown guide

1) Unit test (no-render components): mocha/titef
2) Unit tests (render components): jest + enzyme
3) Integration tests: jest + enzyme
4) E2E: wdio (with mocha)

I am the author of titef*, so 1) can be biased. In 2) I am taking in account snapshot testing. In 3) I am talking about integration between components.

Excluding titef, I'd use mocha for pretty much everything, but snapshots are extremely convenient, especially when you need to deliver fast. Bottom line, my decision tree goes pretty much like:

  • small project, mostly visual, no much logic -> jest + enzyme and mostly snapshot tests
  • small project, lots of logic, dumb or not-so-relevant UI -> mocha (+ enzyme eventually) and mostly unit tests
  • medium project worth a double setup -> mocha, jest + enzyme and unit tests with snapshots
  • big project -> all the above

*: The reason why I started titef was that jest is incredibly slow, but I love snapshot testing. I didn't finish it yet, so right now it's just a faster mocha.

Classic DEV Post from Apr 4

What's an awesome VS Code extension you recently installed?

I just came across a simple yet awesome VS Code extension tonight care of Elija...

pgangwani profile image
Pawan is working as Sr Web developer at JCP, loves to make impact to the customers or masses, comfortable throughout the stack, but presently making difference at front end and devtools.

😓 Sore eyes?

dev.to now has a dark version (in public beta).

Go to the "misc" section of your settings and select night theme ❤️