Istanbul: HTML Code Coverage Report (Documentation)

Created on 25 Oct 2013  路  7Comments  路  Source: gotwarlost/istanbul

I've read the all the documentation I can find for istanbul but not been able to locate an explanation for the colors in the HTML report.

e.g:
http://gotwarlost.github.io/istanbul/public/coverage/lcov-report/istanbul/lib/command/index.js.html

The report has both yellow and pink highlighting.
in case that file gets updated here's a screenshot: istanbul-code-coverage-report-for-istanbul--lib--command--index js-

This is a basic question but what exactly do the colors mean? thanks.

Most helpful comment

  • Pink: statement not covered
  • Orange: function not covered
  • Yellow: branch not covered
  • [I] and [E] in front of if-else statements: if or else not covered respectively
  • Branch coverage display only kicks in if one or more but not all branches have been taken (if none of the branches were taken the statement coverage will show you that unambiguously)

All 7 comments

  • Pink: statement not covered
  • Orange: function not covered
  • Yellow: branch not covered
  • [I] and [E] in front of if-else statements: if or else not covered respectively
  • Branch coverage display only kicks in if one or more but not all branches have been taken (if none of the branches were taken the statement coverage will show you that unambiguously)

Thanks Krishnan.
Is it worth adding this to the README.md for beginners to understand what's the report is saying?
With generic screenshots similar to: https://github.com/nelsonic/learn-istanbul
I could write it up and send you a Pull Request.
Let me know.

Posting my question here, as this is the only place where I found some information regarding the colors in the generated reports.

We're in the process of embedding istanbul into our development workflow and now that we get some reports generated, we wonder how we should read a particular reporting, see the screenshot below. The bit what we don't understand is the green bit in front of the function with the number one, which we think should tell us that the function is called once, but why then do we get the orange telling us that the function is not covered and the pink that the statement is not covered?

2014-07-02_133005

It's confusing. The yellow color says that the function has not been called. The green 1 against it is saying that the function definition was loaded when the file was required.

The basic bug is that function definitions should never have been considered "executable statements" in the first place - this was done to maintain compatibility with older tools that istanbul was replacing.

I can change the code to not consider these statements but then that would reduce the code coverage of all projects using istanbul in a way that might not be apparent to users and cause a flurry of issues...

ok, that at least clarifies things. Maybe put this behind a config option?

It looks ever more odd when you view the annotated source in cobertura in Jenkins: there the entire line that defines the function is marked in green, but the entire function body is pink,

2014-07-02_141950

I've created #223 for the issue discussed in the 4 comments above

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davglass picture davglass  路  49Comments

ouhouhsami picture ouhouhsami  路  16Comments

asciidisco picture asciidisco  路  47Comments

blindenvy picture blindenvy  路  19Comments

niftylettuce picture niftylettuce  路  29Comments