react-testing-library
Simple and complete React DOM testing utilities that encourage good testing practices.
The problem
You want to write maintainable tests for your React components. As a part of
this goal, you want your tests to avoid including implementation details of your
components and rather focus on making your tests give you the confidence for
which they are intended. As part of this, you want your testbase to be
maintainable in the long run so refactors of your components (changes to
implementation but not functionality) don't break your tests and slow you and
your team down.
This solution
The react-testing-library
is a very light-weight solution for testing React
components. It provides light utility functions on top of react-dom
and
react-dom/test-utils
, in a way that encourages better testing practices. Its
primary guiding principle is:
[The more your tests resemble the way your software is used, the more
confidence they can give you.][guiding-principle]