Installing RTL and Configuring Jest for Component Testing

Learn to install React Testing Library and configure Jest for Component Testing in this lesson.

Understanding the starter project

Setting up React is beyond the scope of this course. So, React, Babel, Webpack, and several plugins have been installed and configured in the starter project. The setup is very basic, but it is sufficient for this lesson.

We have already learned how to install Jest. So, Jest is also installed in the starter project.

If we look at the source code files in the project, we’ll see the ErrorMessage component from the previous couple of lessons along with an ErrorMessage test.

We can run the following command to see the rendered ErrorMessage component:

npm start

Get hands-on with 1200+ tech skills courses.