O'Reilly logo

React: Tools & Resources by Manjunath M, Michael Wanyoike, Swizec Teller, Jack Franklin, Ahmed Bouchefra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 3: How to Test React Components Using Jest

by Jack Franklin

In this tutorial, we'll take a look at using Jest – a testing framework maintained by Facebook – to test our ReactJS components. We'll look at how we can use Jest first on plain JavaScript functions, before looking at some of the features it provides out of the box specifically aimed at making testing React apps easier. It's worth noting that Jest isn't aimed specifically at React: you can use it to test any JavaScript applications. However, a couple of the features it provides come in really handy for testing user interfaces, which is why it's a great fit with React.

Sample Application

Before we can test anything, we need an application to test! Staying true to web development ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required