-
Notifications
You must be signed in to change notification settings - Fork 784
Coverage rate is incorrect when some code fragments are ignored #218
Comments
No. Let me think about this some more. |
+1 Facing with the same problem, I'm using some libraries that have their own tests and not needed to be tested. I have 2 modes of compilation. In |
+1 |
+1 Same problem: in the different build modes there is a different coverage report. |
We definitely need more options to handle ignored code. |
same thing |
+1 Is there an update on this? |
I have a similar scenario to @technicallyfeasible |
+1 |
I ended up creating a patch that I include before my tests: https://gist.github.com/technicallyfeasible/5f066d323ddf608e3cac This modifies the computeBranchTotals and computeSimpleTotals functions to report only stats which were not excluded. Simply do require('patch_istanbul') before getting the test run totals or generating the report. |
Hi dev,
I'm using /istanbul ignore next/ to ignore some code fragments. For example, I totally have 1000 lines, and I ignore 900 lines. I have unit tests which covered 50 lines of the left 100 lines. Currently istanbul reports coverage rate as 950 / 1000 = 95%, which takes the 900 lines being ignored as tested. But I think the coverage rate should focus on the left 100 lines only. Within the left 100 lines, only 50 lines are tested, thus the coverage rate should be 50%. [In my case, 900 lines are library, which is built into a combined single javascript file with my code, but testing to the library is not my purpose.]
Is there any configuration that I can use to make istanbul calculate the rate as I expected?
Best regards,
Janet Han
The text was updated successfully, but these errors were encountered: