Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML Code Coverage Report (Documentation) #111

Closed
nelsonic opened this issue Oct 25, 2013 · 7 comments
Closed

HTML Code Coverage Report (Documentation) #111

nelsonic opened this issue Oct 25, 2013 · 7 comments

Comments

@nelsonic
Copy link

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.

@gotwarlost
Copy link
Owner

  • 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)

@nelsonic
Copy link
Author

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.

@pgbakker
Copy link

pgbakker commented Jul 2, 2014

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

@gotwarlost
Copy link
Owner

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...

@p-bakker
Copy link

p-bakker commented Jul 2, 2014

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

@p-bakker
Copy link

p-bakker commented Jul 2, 2014

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

@p-bakker
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants