Reader small image

You're reading from  React 16 Tooling

Product typeBook
Published inApr 2018
Reading LevelBeginner
PublisherPackt
ISBN-139781788835015
Edition1st Edition
Languages
Tools
Right arrow
Authors (2):
Adam Boduch
Adam Boduch
author image
Adam Boduch

Adam Boduch has been involved in large-scale JavaScript development for nearly 15 years. Before moving to the frontend, he worked on several large-scale cloud computing products using Python and Linux. No stranger to complexity, Adam has practical experience with real-world software systems and the scaling challenges they pose.
Read more about Adam Boduch

Christopher Pitt
Christopher Pitt
author image
Christopher Pitt

Christopher Pitt is a principal developer for SilverStripe in Wellington, New Zealand. He usually works on open source software, though sometimes you'll find him building compilers and robots.
Read more about Christopher Pitt

View More author details
Right arrow

Summary


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 used as expected. You then evolved these tests to make use of the inherent asynchronous capabilities of Jest. Unit test coverage reporting is built into Jest, and you learned how to view this report by passing an additional argument.

In the next chapter...

lock icon
The rest of the page is locked
Previous PageNext Chapter
You have been reading a chapter from
React 16 Tooling
Published in: Apr 2018Publisher: PacktISBN-13: 9781788835015

Authors (2)

author image
Adam Boduch

Adam Boduch has been involved in large-scale JavaScript development for nearly 15 years. Before moving to the frontend, he worked on several large-scale cloud computing products using Python and Linux. No stranger to complexity, Adam has practical experience with real-world software systems and the scaling challenges they pose.
Read more about Adam Boduch

author image
Christopher Pitt

Christopher Pitt is a principal developer for SilverStripe in Wellington, New Zealand. He usually works on open source software, though sometimes you'll find him building compilers and robots.
Read more about Christopher Pitt