Why and how we migrated from Mocha to Jest as our client-side test runner

Photo by 🇸🇮 Janko Ferlič on Unsplash

What is Mocha.js? ☕️

Why was Mocha not a great fit anymore? 😢

Artwork created by Kent C. Dodds
  • An end-to-end test is the most reliable, but it takes the longest, and because the test requires making an actual network request, the platform needs to be powerful enough. As a result, it costs money to run.
  • An integration test is excellent, but we don’t gain enough confidence because we mock most components making network requests.
  • A unit test is terrific in its own right, but it doesn’t test a system as a whole, so it is pretty limiting.
  • A static test is mainly for catching typo and type errors.

But how?

  1. Write robust integration tests (don’t test implementation details)
  2. Mock, but very little (we don’t want to charge the credit card on every test)
  3. Write tests that resemble how your users would use your platform.

With what?



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store