- Install enzyme and enzyme react adapter
yarn add -D enzyme enzyme-react-adapter-react-16
- Create a file for test setup
Create a file src/setupTests.js
. It will automatically get picked up by create-react-app.
In this file, put code to run before Tests. for example, to configure enzyme, put this in: