Not showing uncovered branch when `else` is missing
WallabyJS is not reporting uncovered else branches when there is only an if-branch. while Istanbul detects these uncovered branches.
This gives me no uncovered regions, where I expect to have Wallaby detect them also for missing else statements.
var someVar = true;
if (someVar) {
// do something
}
Wallaby

Istanbul

+1 I can't use wallaby exclusively without this.
+1 Same for expressions like:
var a = options.a || defaults.a;
@mprokopowicz Could you please provide some more details about your example?
Wallaby supports those expressions and notifies if a part wasn't hit:
If you mean the case when both parts are hit (but result in false), then istanbul works the same way:

I'm disappointed to see that this was already requested years ago :( Would love to see this in the product.
Why is this closed? Are you refusing to add the feature? I also want the option to turn off the ignoring of missing else statements.
Please note that this feature request has not been closed. We have plans to look into adding this functionality in the future but have no ETA we can provide at this point in time.
I completely misread the reference as this issue being closed. Thanks, @smcenlly.
Any updates on this? Frankly, I'm lazy, and it's an extra step to have to check the Istanbul output just to make sure there's no untested else branches 😄
@didehvar - we do not have any immediate plans to add missing else branches to code coverage calculations but we will take another look over the next month. There are a few items of complexity we need to address:
- Must be opt-in; people are already familiar with our code-coverage calculations and do not always expect else blocks to be included in missing coverage
- Need a good way to display missing else blocks in the editor as there is missing code that we can highlight
Thanks for the response @smcenlly! Opt-in makes a lot of sense.
I'm guessing the if itself would have to be called out as missing coverage, though it doesn't look like there's any messages on hover so I'm not sure how it'd be clearly displayed. Uncovered code regions doesn't help either as there's nothing to highlight. Hopefully someone smarter can come up with something 😄