April 2018
Intermediate to advanced
298 pages
6h 34m
English
In this chapter, you learned about Jest. You learned that the key driving principles of Jest are creating effective mocks, test isolation and parallel execution, and ease of use. You then learned that react-scripts makes running your unit tests even easier by providing some basic configuration to use with Jest.
When running Jest, you saw that watch mode is the default when running Jest via react-scripts. Watch mode is especially useful when you have lots of tests that don't need to run every time you make a source change—only relevant tests are executed.
Next, you performed some basic assertions in your unit tests. Then, you created a mock for the fs module and performed assertions on the mocked functions to ensure that they're being ...