-
Notifications
You must be signed in to change notification settings - Fork 41
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
Merge all values of the hierarchy using max
#27
Conversation
if (hasChildren()) { | ||
replaceValue(old.add(otherValue)); | ||
try { | ||
var max = old.max(otherValue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this functionality it's still a replace right? It just takes the coverage that's higer.
If there is a file with the functions a
and b
, coverage X covers func a
and coverage Y covers function b
, it's 50% overall coverage instead of 100% right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is still not clear on how to merge inner nodes 😞
The code works for leaves but not for inner nodes yet. I can drop the details of inner nodes and compute them on my own but that will cause other problems...
Do you have an idea on how to implement this correctly? I do not see a solution for this problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have much experience with coverage reports, but by just looking at the cobertura one, I would expect that the lines should be merged (identified by number and branch) and hits > 0
should be preferred
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After adding some more tests it looks that the merge using max
is working correctly.
With this functionality it's still a replace right? It just takes the coverage that's higer.
If there is a file with the functions a and b, coverage X covers func a and coverage Y covers function b, it's 50% overall coverage instead of 100% right?
No, since each file has a coverage for X and Y. So X contains a=100% and b=0%, and Y contains a=0% and b=100%, then the max will produce a=100% and b=100%.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean it's more correct than before.
Lets say we have function A.
function A(flag: boolean) {
if(flag) {
console.log('true');
} else {
console.log('false');
}
}
If you have two separate coverage reports, one with the file x.spec.test
that tests A
only with true
and one with the file y.spec.test
that tests A
only with false
, then both of them would have the same coverage (about 50%) and the code-coverage-api would return 50% right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean it's more correct than before. Lets say we have function A.
function A(flag: boolean) { if(flag) { console.log('true'); } else { console.log('false'); } }If you have two separate coverage reports, one with the file
x.spec.test
that testsA
only withtrue
and one with the filey.spec.test
that testsA
only withfalse
, then both of them would have the same coverage (about 50%) and the code-coverage-api would return 50% right?
No, the coverage is not measured per method, it is line based. The coverage per method is computed from the line coverage. So you should get a 100% coverage in total.
Codecov Report
@@ Coverage Diff @@
## main #27 +/- ##
============================================
+ Coverage 85.91% 85.96% +0.05%
Complexity 492 492
============================================
Files 23 23
Lines 1356 1361 +5
Branches 194 193 -1
============================================
+ Hits 1165 1170 +5
+ Misses 145 144 -1
- Partials 46 47 +1
... and 2 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
See jenkinsci/code-coverage-api-plugin#729
Tasks to do:
add
withmax
for inner nodes as well