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

Questions about the coverage-final.json file #717

Open
supermacro opened this issue Feb 23, 2023 · 1 comment
Open

Questions about the coverage-final.json file #717

supermacro opened this issue Feb 23, 2023 · 1 comment

Comments

@supermacro
Copy link

Hey there, I'm currently working on a diff tool to compare coverage between two git branches.

I am implementing this tool by comparing the coverage-final.json between the two branches and seeing how coverage has changed.

Some extra (although potentially irrelevant) context: Keep in mind that one potential change between two git branches is that in branch production you have a file called original-filename.txt and in the feat/add-widget branch, this file was renamed to modified-file-with-new-name.txt. So I need to depend on git itself to tell me which files on production relate to feat/add-widget because original-filename.txt does not exist in feat/add-widget.

Questions

Question 1

What do the integer numbers represent for the s (statement coverage) and and f (function coverage) objects?

image

From basic deduction, I was able to tell that the integer 0 means that this particular statement has no coverage, while any non-zero number represents that the statement is covered. Therefore one can tell that in this screenshot, the file has 32/34 statements covered (94% coverage).

But what else does the non-zero value tell me? Is 23 and 851 of any significance?


Question 2

Where is line coverage?

The coverage-final.json file contains the following fields for each file:

  • path: the absolute file path
  • statementMap: metadata about statements in this file
  • fnMap: metadata about functions in this file
  • branchMap: metadata about code branches in this file
  • s: coverage info about statements in this file
  • f: coverage info about functions in this file
  • b: coverage info about code branches in this file

... So I am wondering how one calculates line coverage?


Question 3

How do i understand how to analyze branch coverage?

image

What does the right-hand-side tell me about the left-hand-side?

@supermacro
Copy link
Author

I see there's this page ... maybe @gotwarlost or @kitsonk can comment?

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

1 participant