-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add decision/condition coverage #5
Comments
Can you give an example of what you want here? What statistics do you want to collect? |
Here's a simple example:
This will report as 100% coverage. I covered all lines and all blocks however I did not cover all branches. What if the if statement evaluates to false? That is currently not being reported. Here's another example with ternary operator:
|
In the first case, you are covering all branches, no? Your 'if' condition evaluates to true. I agree that if it was false, you would have had less than 100% coverage, but I think it would report it as less than a 100%, no? For the second case, you're right, we're misreporting to some degree. If you had I think I have a fix in mind to give more correct stats for some of these cases. Open to ideas/suggestions. |
Can you try installing the new version ( |
The first case was a trivial example. But yes, I do in fact have 100% line coverage but my testing code is "flawed" in the sense that I'm not ever checking Btw I don't mind checking out and building from git so you don't have to be publishing packages to npm. |
Thanks - let me know if the fix worked for you :) |
So, the fix worked fine for the ternary operator example. If I were to nitpick though, it told me I missed a |
I see. There are a couple of ways to look at it: In this case, it's telling you that you missed a partial line, because you covered some parts of the line but not others (that's why it is in yellow). There are other cases that aren't really "branches". Consider for example: I do think that it might be interesting to add secondary stats beyond line and block coverage. For example, we could add function-coverage and branch-coverage. I'll think about adding those. Any suggestions are welcome! |
function coverage would be great. I'll keep posting more issues as I find them. |
No description provided.
The text was updated successfully, but these errors were encountered: