-
Notifications
You must be signed in to change notification settings - Fork 10
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
block and function level coverage are incompatible and should not be merged #2
Comments
As mentioned in #3, I'd like to keep this issue open a bit longer. The old implementation did not use The fix in #3 ensures that function covs with mixed I'd prefer a solution that preserves all function coverage information. I see two solutions:
These two solutions allow to keep all the information. It would allow consumers to display better information. For example, Istanbul's reporters allow to distinguish between function counts and statement counts. The first solution is easier to consume: there is only one I prefer the first solution, but maybe strict compliance with the V8 schema is needed. What is your opinion @bcoe? |
Are these function coverages with different granularity part of the coverage of the same Node process or not? If they are both part of the same process coverage, then the second solution (to keep both and merge them separately) is better as it matches what happens already in V8. |
@demurgos I don't have a strong opinion about implementation. I think the case in which we'd want to use function coverage and non-function coverage in conjunction is a pretty rare edge-case. You're either probably running your entire test-suite with block coverage enabled (detailed) or running it with only function coverage. I'm not why running the Node test suite was outputting both types of coverage; this was potentially a race condition in which V8 did not have detailed coverage enabled fast enough. |
I was not able to produce mixed If there's a way to get mixed |
This also solves issues in complex cases that don't even involve mixed
Overall, the function is called 40 times, but no statement is called more than 31 times. By attaching the total count we can get better precision. |
Hi, I found that mixed isBlockCoverage causes information with isBlockCoverage==false lost. |
When an attempt is made to merge block-level granularity (
isBlockCoverage = true
) and function level granularity (isBlockCoverage = false
), the two types of coverage are incompatible resulting in coverage that claims to have hit unreachable lines of code:☝️ this is the Node.js test suite run on OSX, therefore code after
isWindows
should not be hit, the reason it's reported that the lines are hit 3 times, is that Node.js outputs a report with function level granularity that indicates thatrealpathSync
is executed ...this is probably due to the fact that
fs.js
is used during the Node.js bootstrapping process, before the inspector has block-level coverage enabled.Solution
block level coverage should take precedence over function level coverage as soon as it's observed.
The text was updated successfully, but these errors were encountered: