What does /* istanbul ignore next */ do?

Answered
nick asked this question 2 months ago
nick on Mar 23

I'm reading someone else's JavaScript code and came across this line of code:

/* istanbul ignore next */

What does this line of code do?

2 suggested answers
looper003 12 days ago

istanbul is a JavaScript code coverage tool.

Some things are hard to test, so /* istanbul ignore next */ tells istanbul to skip and not include the next thing in your source code when calculating code coverage for your project.

0 replies
coderguy 12 days ago

It's a way to exclude code in your project in code coverage reports.

More info here: github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md.

0 replies
Answered