Jest & React Testing Library

In notebook:
FrontEndMasters Intermediate React
Created at:
2019-06-25
Updated:
2019-08-15
Tags:
React libraries JavaScript testing

https://frontendmasters.com/courses/intermediate-react-v2/jest-react-testing-library/

Testing UI is not fun

Especially when the UI changes regularly, like at Netflix the homepage, you write the tests, but then have to delete them as soon as the homepage has a new design (happened every day at Netflix).

This is why he is not writing a lot of tests for React. On the other hand, if there are API calls, he will make sure to have the maximum of coverage on that. Also testing the modules as much as possible, but not the UI components.

There's another course on frontendmasters that goes in depth into testing React.

He is using the Jest test runner.

npm install -D jest react-testing-library

Creates directory: __tests__, called dunders, meaning "magical".

Jest will know where to look for tests.