Search code examples
node.jsunit-testingcode-coverageistanbulnode.js-tape

nodejs - How to check which portion of code is tested with unit tests?


I am using tape and istanbul to write unit tests in my Node.js project and the result is the following:

Statements   : 93.04% ( 107/115 )
Branches     : 86.84% ( 33/38 )
Functions    : 90% ( 27/30 )
Lines        : 93.86% ( 107/114 )

Is there a way to find out which statements, functions or portion of the code is left untested?


Solution

  • According to the doc you should find a complete html report under ./coverage with line by line coverage :

    and this should produce a coverage.json, lcov.info and lcov-report/*html under ./coverage Sample of code coverage reports produced by this tool (for this tool!): HTML reports

    Doc : https://github.com/gotwarlost/istanbul#getting-started