Is it possible to ignore the marker E
in istanbul branch coverage?
I am using Jasmine+karma+Istanbul. Is there any possibility to ingore E
and get 100% branch coverage?
Maybe a property that can be set in config?
Here is an example of the coverage results
Just add /* istanbul ignore else */ before if statement which do not have else part. Coverage reporter will ignore the else path.
To calculate Branch Coverage, one has to find out the minimum number of paths which will ensure that all the edges are covered. In this case there is no single path which will ensure coverage of all the edges at once. The aim is to cover all possible true/false decisions.
It is up to the caller to scope this as narrowly as possible. For example, if you have a source file that is wrapped in a function expression, adding /* istanbul ignore next */ at the top of the file will ignore the whole file!
To efficiently cover all 6 branches in this case, the test function must be called no less than 4 times to achieve 100% branch coverage.
You can use /* istanbul ignore else*/
just before the if
statement to ignore the missing else
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With