In this tutorial I’ll show you how to set up a test suite for your React
application by leveraging
First, let’s install the tools:
(I’m assuming you’ve already installed React.)
Create a bootstrap file with the following contents:
This will initialize your testing environment and create a virtual DOM where
the test runner will be able to mount your components. It will also decorate
Chai’s assertion library to support JSX and Enzyme.
Next, let’s add a test script to package.json:
Running this script will boot up Mocha, load the bootstrap file, and run any
test files in src that match the pattern *.test.js*.