In this recipe, we are going to learn how to install and configure Jest in our project.
Testing our first component with Jest and Enzyme
Getting ready
In this recipe, we need to install a few packages to test our React application:
npm install --save-dev jest jsdom enzyme enzyme-adapter-react-16 identity-obj-proxy
How to do it...
After we've installed Jest, we need to configure it:
- Add the tests scripts and the Jest configuration into our package.json:
{
"name": "react-pro",
"version": "1.0.0",
"scripts"...