Get Started with JestGet Started with Jest

Jest is a testing framework widely used in React projects. It provides a bunch of useful utilities. Jest is easy to configure, supports code coverage, and is a powerful tool for testing React components and applications.

Setting up a new React project with Jest

Here is the code from the recording: GitHub

Step 1: Create a new React project

Let's create a new React project using create-react-app in the terminal:

Step 2: Install Jest library

Since Jest is not pre-installed with create-react-app, we must install it separately to enable testing for the React project. To install Jest, open the terminal and run the following command:

This will download and install Jest. Additionally, it will update the package.json file to include Jest in the dependencies section. The package.json should now include Jest similar to the following:

Project overview

The Jest learning will consist of theoretical and practical parts. In the following chapters, we will learn how to write tests for the Counter App. This approach will help us understand the theory better and apply our knowledge immediately through practical examples.


The app has been entirely built but still lacks tests. Please take the time to inspect the app and ensure that everything is clear. As in the following chapters, we will dive into testing.

Everything was clear?

Section 5. Chapter 2