Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to ignore branch coverage for missing 'else'

Tags:

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 example of the error

like image 870
rajesh madaswamy Avatar asked Aug 07 '15 17:08

rajesh madaswamy


People also ask

How do you cover else path not taken in jest?

Just add /* istanbul ignore else */ before if statement which do not have else part. Coverage reporter will ignore the else path.

How do I cover branch code coverage?

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.

How can I ignore next in Istanbul?

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!

How do I increase branch coverage in Jacoco?

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.


1 Answers

You can use /* istanbul ignore else*/ just before the if statement to ignore the missing else.

like image 184
Anobika Avatar answered Oct 26 '22 01:10

Anobika