Skip to Content
React 16 Tooling
book

React 16 Tooling

by Adam Boduch, Christopher Pitt
April 2018
Intermediate to advanced content levelIntermediate to advanced
298 pages
6h 34m
English
Packt Publishing
Content preview from React 16 Tooling

Unit test coverage

Jest comes with built-in support for test coverage reporting. It's nice to have this included as part of your test framework because not all of them have this support. If you want to see what your test coverage looks like, simply pass the --coverage option when starting Jest as follows:

npm test -- --coverage 

When you do this, tests are run as normal. Then, the coverage tool inside Jest will figure out how well your tests cover your source, and will produce a report that looks like this:

----------|--------|----------|---------|---------|----------------|
File      |% Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
----------|--------|----------|---------|---------|----------------|
All files | 2.17 | 0 | 6.25 | 4.55 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Pro React 16

Pro React 16

Adam Freeman

Publisher Resources

ISBN: 9781788835015Supplemental Content