I\'ve always used Jasmine for my unit tests, but recently I started using Istanbul to give me code coverage reports. I mean I get the gist of what they are trying to te
Running istanbul should also produce an HTML file for the report (should be in the coverage folder). This HTML should give you drill-down information when you click on files/folders.
The percentage of functions covered is calculated by the number of functions that were called during tests, divided by total number of functions. Same goes for lines and statements (which will usually be close to each other unless you have very long statements).
Branches mean decision points like if-else
blocks. For example, say your code only contains one if-else
statement, and your tests only pass through the if
part but not the else
part, then your branches percentage should be 50%.
Hope that makes things clearer.