mirror of
https://github.com/jbranchaud/til
synced 2026-01-05 08:08:02 +00:00
Add Test Coverage Stats With Jest as a javascript til
This commit is contained in:
@@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
|
|||||||
For a steady stream of TILs from a variety of rocketeers, checkout
|
For a steady stream of TILs from a variety of rocketeers, checkout
|
||||||
[til.hashrocket.com](https://til.hashrocket.com/).
|
[til.hashrocket.com](https://til.hashrocket.com/).
|
||||||
|
|
||||||
_652 TILs and counting..._
|
_653 TILs and counting..._
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -255,6 +255,7 @@ _652 TILs and counting..._
|
|||||||
- [Splat Arguments To A Function](javascript/splat-arguments-to-a-function.md)
|
- [Splat Arguments To A Function](javascript/splat-arguments-to-a-function.md)
|
||||||
- [Spread The Rest With ES6](javascript/spread-the-rest-with-es6.md)
|
- [Spread The Rest With ES6](javascript/spread-the-rest-with-es6.md)
|
||||||
- [String Interpolation With Template Literals](javascript/string-interpolation-with-template-literals.md)
|
- [String Interpolation With Template Literals](javascript/string-interpolation-with-template-literals.md)
|
||||||
|
- [Test Coverage Stats With Jest](javascript/test-coverage-stats-with-jest.md)
|
||||||
- [Throttling A Function Call](javascript/throttling-a-function-call.md)
|
- [Throttling A Function Call](javascript/throttling-a-function-call.md)
|
||||||
- [Timing Processes](javascript/timing-processes.md)
|
- [Timing Processes](javascript/timing-processes.md)
|
||||||
- [Transforming ES6 and JSX With Babel 6](javascript/transforming-es6-and-jsx-with-babel-6.md)
|
- [Transforming ES6 and JSX With Babel 6](javascript/transforming-es6-and-jsx-with-babel-6.md)
|
||||||
|
|||||||
24
javascript/test-coverage-stats-with-jest.md
Normal file
24
javascript/test-coverage-stats-with-jest.md
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# Test Coverage Stats With Jest
|
||||||
|
|
||||||
|
Jest is a delightful tool for JavaScript testing from Facebook. As your
|
||||||
|
project evolves and you add tests (or perhaps choose to not add tests) you
|
||||||
|
may wonder what kind of test coverage you have. What is the overall
|
||||||
|
coverage? Which files are well covered and which are seriously lacking?
|
||||||
|
|
||||||
|
Use the `--coverage` flag to get this information.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ jest --coverage
|
||||||
|
```
|
||||||
|
|
||||||
|
After running all of your tests a table will be output to the terminal with
|
||||||
|
a list of files and their respective coverage percentages in terms of
|
||||||
|
statement, branch, function, and line coverage.
|
||||||
|
|
||||||
|
```
|
||||||
|
---------------------------|----------|----------|----------|----------|----------------|
|
||||||
|
File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
|
||||||
|
---------------------------|----------|----------|----------|----------|----------------|
|
||||||
|
```
|
||||||
|
|
||||||
|
This can help guide you to what parts of your app may need more testing.
|
||||||
Reference in New Issue
Block a user