React Testing Library Recipes

This repository is a collection of common testing recipes for using React Testing Library.

It was created as a companion to my blog post over here: React Testing Library Recipes

Prerequisites

Node and NPM.

When ready, but sure to install this repository’s dependencies:

npm install

Running the tests

A package script is available to run all tests:

npm run test

Advice

The recipes in this repo have all been useful to me at different times. But no recipe will be useful in every situation. Use your best judgement and descretion when applying these recipes in your code. If you find yourself developing a new recipe not listed in this repo, I’d love you to submit an issue or PR to this repo. If I think it’ll be helpful to others I’ll gladly add it.

GitHub

View Github