Testing React With Jest

Jest is a delightful JavaScript Testing Framework with a focus on simplicity. More info

Articles & Tutorials

Testing apps with Jest and React Testing Library (blog.logrocket.com)
Mar 01, 2021
In this article, we’ll test React applications with Jest and React Testing Library, a popular combination of a JavaScript testing framework and a React utility for testing components.
  • Juan Cruz Martinez
Testing UI - Next JS, Typescript, Jest and React Testing Library (dev.to)
Nov 10, 2020
As you know, React is just JavaScript. That means it can be tested just like any other JS application. There are lots of testing libraries and test runners out there, but I find that the best setup is Jest + React Testing Library.
  • Maciek Grzybek
Testing with react-testing-library and Jest (blog.bitsrc.io)
Aug 04, 2020
In this post, we’ll look at two libraries that enable us to carry out UI testing in our React application.
  • Chidume Nnamdi
A Practical Guide To Testing React Applications With Jest (smashingmagazine.com)
Jun 24, 2020
Building a well-functioning application requires good testing; otherwise, knowing whether your application works as expected would be a matter of guesswork and luck. Jest is one of the best tools available for testing React applications.
  • Adeneye David Abiodun
Testing state changes in React functional components (blog.logrocket.com)
Jun 01, 2020
Learn how to test your React functional components and the state changes for components that use hooks with Jest and Enzyme as testing libraries.
  • Eslam Hefnawy
Jest tests with react context api (itnext.io)
Apr 01, 2020
I always find myself doing dumb mistakes all over the code that could easily be caught by well-written tests. Last fall I attended this conference where this workshop leader said if you really want your developers to write good tests, you have to make the developers accountable. And you do that by fire all the testers. I love testers though.
  • Malin Milford
How to Start Testing Your React Apps Using the React Testing Library and Jest (freecodecamp.org)
Mar 12, 2020
Testing is often seen as a tedious process. It's extra code you have to write, and in some cases, to be honest, it's not needed. But every developer should know at least the basics of testing. It increases confidence in the products they build, and for most companies, it's a requirement.
  • Ibrahima Ndaw
Testing Custom React Hooks with Jest (newline.co)
Dec 10, 2019
Hooks in React are a new, popular, and extensible way to organize side-effects and statefulness in React components. By composing the base hooks provided by React, developers can build their own custom hooks for use by others.
  • James P. Fulford
Writing end-to-end tests for GraphQL servers using Jest (blog.logrocket.com)
Nov 24, 2019
Writing end-to-end tests for applications helps to ensure applications behave as expected. It also comes in handy when we add new features to existing applications because it ensures the newly introduced features integrate well with our already existing features.
  • Gbolahan Olagunju
Testing Universal React (Native) Apps with Jest and Expo! (blog.expo.io)
Sep 26, 2019
Unit testing with Jest is an integral part of projects that are built with React. But we’ve also found that sometimes entire classes of bugs slip through with several Jest configurations, such as the preset included with React Native, and the testing never seems to really cover everything.
The Big Mac index and Jest fetch testing (swizec.com)
Aug 22, 2019
The Big Mac index is a purchasing power parity index published by The Economist. Jest fetch testing is a tech task so frustrating that it almost made me quit the industry.
How to Jest Snapshot Test the Difference (robinwieruch.de)
Aug 15, 2019
Snapshot tests are a common way to write lightweight component tests. When a snapshot test runs for the first time, it stores its output (e.g. rendered component’s HTML structure) in a snapshot output file.
How to shallow render Jest Snapshot Tests (robinwieruch.de)
Aug 10, 2019
If you are using Snapshot Tests with Jest for your components, there are a few pitfalls you have to be aware of.
Simplifying Gatsby Unit Testing using a Jest Preset (dev.to)
Aug 10, 2019
Recently I have been expanding the codebase for my website and blog in order to have a more robust web presence. Part of this of course includes unit testing the source code using Jest.
  • Kepler Sticka-Jones
How to test React components with Jest & Enzyme (robinwieruch.de)
Jul 17, 2019
In this React testing tutorial, we will introduce Enzyme in our Jest testing environment.
How to test React components with Jest (robinwieruch.de)
Jul 16, 2019
Jest got introduced by Facebook for testing JavaScript and especially React applications. It’s one of the most popular ways to test React components nowadays. Since it comes with its own test runner, you can simply call Jest from the command line to run all your tests.
React/Redux Integration Tests with Jest & Enzyme (itnext.io)
Jun 12, 2019
I write tests because I want to be confident about two things: 1) That I didn’t break any existing code. (Existing tests to the rescue). 2)That my new code works as intended.
  • Quinton Aiken
Writing Tests for React Applications Using Jest and Enzyme (css-tricks.com)
Mar 01, 2019
While it is important to have a well-tested API, solid test coverage is a must for any React application. Tests increase confidence in the code and helps prevent shipping bugs to users. That’s why we’re going to focus on testing in this post, specifically for React applications. By the end, you’ll be up and running with tests using Jest and Enzyme.
  • Kingsley Silas
Jest 24: Refreshing, Polished, TypeScript-friendly (jestjs.io)
Jan 25, 2019
Today we are happy to announce the next major release of Jest - version 24! It's been 4 months since the last minor release, and 8 months since Jest 23, so this upgrade is a big one, with something for everyone!
  • Simen Bekkhus
Testing React components (flaviocopes.com)
Jan 05, 2019
Test your first React component using Jest and `react-testing-library`
How to set up Jest & Enzyme like a boss (medium.freecodecamp.org)
Nov 12, 2018
When I started out writing tests for my React application, it took me some tries before I figured out how to set up my testing environment using Jest & Enzyme.
  • Adeel Imran
Test-Driven Development with React, Jest, and Enzyme - Part 2 (testdriven.io)
Nov 06, 2018
In this part, we'll finish the UI by adding the number and operator keys before we dive in to adding the basic calculator functionality.
  • Caleb Pollman
Test-Driven Development with React, Jest, and Enzyme - Part 1 (testdriven.io)
Nov 06, 2018
In this post, we'll develop a React app using Test-Driven Development (TDD) with Jest and Enzyme.
  • Caleb Pollman
Components testing in React: what and how to test with Jest and Enzyme (medium.freecodecamp.org)
Oct 03, 2018
Testing React components may be challenging for beginners as well as experienced developers who have already worked with tests. It may be interesting to compare your own approaches with the ones we use in our project. In order to cover the codebase, you have to know which components must be tested and which code exactly in the component should be covered.
  • Alyona Pysarenko
How to Test React Components using Jest and Enzyme (blog.bitsrc.io)
Sep 26, 2018
Learn how to test React components using Jest and Enzyme
  • Linh Nguyen My
Reactjs Unit Testing with Storybook + Jest (blog.cloudboost.io)
Sep 23, 2018
Reactjs is a UI library by facebook while Storybookjs is a testing tool for components by representing different states of the component and Jest is another cool unit testing tool by the creators of reactjs for javascript including reactjs.
  • Danstan Onyango
Testing Components in React Using Jest and Enzyme (code.tutsplus.com)
Aug 17, 2018
In this post, we'll get a deeper understanding of testing components in React by writing more practical and realistic tests.
  • Manjunath M
Testing Components in React Using Jest: The Basics (code.tutsplus.com)
Aug 10, 2018
In this article, I will take you through everything that you need to know to write tests for your React components. I'll also cover some of the best practices and techniques while we're at it.
  • Manjunath M
Demystifying Jest Async Testing Patterns (medium.com)
Aug 09, 2018
In this post I’d like to demystify some of these async patterns and highlight the traps that are hidden inside.
  • Liran Tal
Testing React / Redux Apps with Jest & Enzyme - Part 2: Testing React Components (alligator.io)
Jun 03, 2018
In this part we’ll cover some simple examples on how to test React components.
  • Jasper Valero
Testing React / Redux Apps with Jest & Enzyme - Part 1: Installation & Setup (alligator.io)
May 20, 2018
Learn how to install and setup Jest and Enzyme for testing React.
  • Jasper Valero
End-to-end testing React apps with Puppeteer and Jest (blog.logrocket.com)
May 09, 2018
In this tutorial, we’ll see how to write tests for a React app using Jest and Puppeteer. Testing is an important part of modern web application development, it helps to check if the code you wrote is acceptable and works as accepted. It’s a way of catching bugs in your code before you go “live”.
  • Yomi Eluwande
Testing your React App with Puppeteer and Jest (blog.bitsrc.io)
May 07, 2018
How to use Puppeteer and Jest to perform End-to-End Testing on your React App
  • Rajat S
React Testing Tutorial: Test Frameworks & Component Tests (robinwieruch.de)
Mar 19, 2018
A React tutorial on how to setup and use React component tests with testing frameworks such as Mocha, Chai, Sinon, Enzyme and Jest.
Tutorial: User Interface Testing with Jest and Puppeteer (valentinog.com)
Mar 11, 2018
I started to consider testing with Jest and Puppeteer right after the library came out. Puppeteer has quite an interesting API.
  • Valentino Gagliardi
Understanding Jest Mocks (medium.com)
Mar 08, 2018
Recently, I joined Jest as a collaborator to help triage the issue tracker, and I’ve noticed a lot of questions about how mocking in Jest works, so I thought I would put together a guide explaining it.
  • Rick Hanlon II
Debugging a Create React App with VS Code (elijahmanor.com)
Feb 05, 2018
In this post we’ll look at how to configure Visual Studio Code to debug React Components and Jest Unit Tests inside a web application that was created by create-react-app.
  • Elijah Manor
Testing in React Native  -  Jest & Detox (pillow.codes)
Sep 08, 2017
Writing unit & end-to-end tests to ship your mobile app with confidence.
  • Monte Thakkar
Snapshot Testing React with Jest (daveceddia.com)
Apr 05, 2017
Testing is a double-edged sword. On one hand, having a solid test suite makes code easier to refactor, and gives confidence that it works the way it should. On the other hand, tests must be written and maintained. They have a cost, like any other code.
Testing React Applications with Jest (auth0.com)
Jan 26, 2017
Learn how to test React applications with the Jest JavaScript testing framework.
  • Joyce Echessa

Video Guides & Talks

Mocking Fetch Using jest-fetch-mock (youtube.com)
May 16, 2020
This video focuses on testing a function which makes a fetch call, mocking fetch using the jest-fetch-mock package rather than mocking the module manually ourselves (like we did in the previous video).
How to make Jest run anything (youtube.com)
Jan 11, 2019
This is to show how my custom jest-node-runner works.
Jest Architecture (youtube.com)
Nov 20, 2018
This overview by Christoph Nakazawa, Rick Hanlon II and Rubén Norte explains the basic architecture of Jest and what it takes to run a single test.
  • Christoph Nakazawa
Effective unit testing (youtube.com)
Nov 15, 2018
True units are awesome to test!
Use jest's expect module without jest (youtube.com)
Nov 14, 2018
James Long tweeted about how you can do this and I thought it'd be cool to share :)
Debug Jest Tests (youtube.com)
Aug 09, 2018
Sometimes it's just really nice to step through your code line-by-line. Here we'll cover how you can run your jest tests in Chrome's DevTools using node --inspect-brk.
Make jest run anything (youtube.com)
Jun 20, 2018
Jest is more than a testing framework. It's a platform. And you can make it run just about anything for you.
Jest Crash Course - Unit Testing in JavaScript (youtube.com)
Apr 20, 2018
In this video we will get started with JavaScript unit testing using Jest. We will look at how to setup Jest, different matchers as well as how to test async code, run functions before and after different tests, etc.
Mocking Axios in Jest + Testing Async Functions (youtube.com)
Apr 13, 2018
In this video we'll look at a function that makes an HTTP request using the axios library to the Unsplash API and figure out how we can test it using a fake/mock version of axios to avoid performing real HTTP requests. We will be using Jest and some mocking functionality that it provides.
What Is Jest? (youtube.com)
Apr 11, 2018
In this video, I answer the question, what is Jest?
Testing Asynchronous Components with Mocks in Jest (youtube.com)
Apr 06, 2018
In this video we'll cover how to test React components that contain asynchronous code using mocks in Jest. We'll refactor our component to make it more easily testable and mockable, allowing the test to run without making an actual AJAX request.
JS Testing 101 with Jest (youtube.com)
Apr 03, 2018
In this series, we'll cover the skills needed to understand the how and why of JavaScript testing.
Getting started with testing in React (youtube.com)
Mar 29, 2018
In this video we talk about how to test components in React within create-react-app, how to configure Jest with Enzyme and Sinon, how to test with snapshots, simulate clicks, and interact with DOM elements through Enzyme.
Debugging a Create React App with VS Code (youtube.com)
Feb 05, 2018
In this post we’ll look at how to configure Visual Studio Code to debug React Components and Jest Unit Tests inside a web application that was created by create-react-app.
Testing API Contracts with Snapshots (youtube.com)
Dec 04, 2017
Dave Ceddia talks about using Jest's snapshot testing to verify your APIs are working as expected.
JavaScript & React Testing with Jest (youtube.com)
Sep 08, 2016
Jest has become one of the coolest things in testing JavaScript and React. In recent months, the Jest team has made huge strides with the testing framework and it's a pretty amazing tool.

Courses & Video Series

React Recipes (lynda.com)
Jul 16, 2018
This course provides tested, easy-to-follow instructions to solve the most common challenges that React developers face every day
  • Diego Muracciole
Testing React Applications, v2 (frontendmasters.com)
May 13, 2018
Learn to catch errors before they reach the end user with automated tests!
Testing React Applications with Jest (pluralsight.com)
May 10, 2018
This course will teach you basic and intermediate Jest testing techniques, including running tests, snapshot testing, testing React components, and module mocking.
Test React Components with Enzyme and Jest (egghead.io)
May 09, 2018
In this course we are going to work through properly setting up Enzyme with Jest to test rendered components.
  • Tyler Clark
Testing React with Enzyme and Jest (javascriptplayground.com)
Feb 12, 2018
A video series to enable you to test React components thoroughly, refactor with confidence and abstract logic out of components
React: Testing and Debugging (lynda.com)
Jul 05, 2017
Learn how to test, debug, and optimize your React code with tools like Jest, Chrome, ESLint, and flow.
Testing JavaScript Applications (feat. React and Redux) (frontendmasters.com)
Jun 20, 2017
Create automated testing so you can be sure you’re maintaining the highest quality JavaScript applications possible!

Libraries

jest (jestjs.io)24375
v24.8.0
May 05, 2019
Delightful JavaScript Testing
  • Christoph Nakazawa
  • Simen Bekkhus
  • Aaron Abramov
  • Facebook