gotwarlost / istanbul

Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale.
Other
8.7k stars 787 forks source link

How to ignore code coverage of the .catch in promise? #844

Open kdlcruz opened 7 years ago

kdlcruz commented 7 years ago

I'm using bluebirdjs library for my promise implementation but I can't find a way to ignore the .catch((err) => err) with the code coverage. Is this possible?

jeromekimbrough commented 6 years ago

I have the same question. Is there a way to not take those into account in the coverage?

ORESoftware commented 6 years ago

I think you want to take this into account, why wouldn't you? bad code in those catch blocks will take down your app unless you test those paths too.

jarronshih commented 6 years ago

I have the same problem. I use the following code and it works.

.catch(/* istanbul ignore next */ err => next(err));