How to do it...

To have Jest produce a coverage report, showing what parts of your code were (and weren't) covered by your tests, all you have to do is add a pair of parameters to the corresponding script in the package.json file:

 "test": "jest out/ --coverage --no-cache"

In the preceding line of code, the first parameter, --coverage, tells Jest to collect all of the necessary information, and the second parameter, --no-cache, ensures that all information will be fresh; in certain situations, not totally correct results have been produced when this parameter was omitted. How does this affect the testing? Let's see!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset