April 2018
Intermediate to advanced
298 pages
6h 34m
English
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 ...