This chapter describes the configurations used to make jest and react work together. Some of it it’s the default configuration, some of it it’s added to make things smoother and solve a set of common problems.

NPM packages

Packages that come pre-installed with create-react-app:

  • jest + jest-***: the actual library and its extensions
  • babel-core, babel-jest + default babel plugins: to transform the code into plain JavaScript (remember, JEST is actually for testing core JS)

Then, there’s a list of packages that can be installed along the way to make things smoother (install with — -dev):

Libraries that help a lot with mocking

Learn how to create and run UI tests for your React applications. Use JEST as the building framework, and a lot of libraries on top of it to make your life a bit complicated, but much easier.

For this to work, it’s assumed that you’re already familiar with React (otherwise, why would you want to test your components?).

By default, by using create-react-app, your project comes pre-configured with JEST, a (rather popular) testing framework for JavaScript.

JEST works with plain JavaScript, and React uses some more advanced syntax, as a result, some babel configurations are in place to help compile…

Marian FX

Software engineer, creative thinker.

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