You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a couple of if statements which if matched return. One of the two will return in all real-world cases so I want to ignore the fallback return statement.
if(diff>0)return1;/* istanbul ignore else */if(diff<0)return-1;return0;
But I'm getting told that the return 0 line is not covered. If I instead use a /* instanbul ignore next */ just before the return 0 line, now it tells me that the if (diff < 0) line is uncovered.
I found that I need to include both ignore statements:
if(diff>0)return1;/* istanbul ignore else */if(diff<0)return-1;/* istanbul ignore next */return0;
Is this as intended?
I found I can also do this, but I don't like the code:
if(diff>0)return1;/* istanbul ignore else */if(diff<0)return-1;elsereturn0;
The text was updated successfully, but these errors were encountered:
I have a couple of
if
statements which if matched return. One of the two will return in all real-world cases so I want to ignore the fallback return statement.I'm reading the docs at https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md and it looks like the following should do what I want:
But I'm getting told that the
return 0
line is not covered. If I instead use a/* instanbul ignore next */
just before thereturn 0
line, now it tells me that theif (diff < 0)
line is uncovered.I found that I need to include both ignore statements:
Is this as intended?
I found I can also do this, but I don't like the code:
The text was updated successfully, but these errors were encountered: