zianke
zianke

Reputation: 53

Mocha doesn't exit when using Istanbul for code coverage

I'm using Mocha 5 which requires mocha --exit to run tests. Then I try to add istanbul for code coverage by running istanbul cover node_modules/mocha/bin/_mocha. In this case mocha cannot exit. Is there any way to add an exit flag like --exit?

I have tried Mocha 3 which works fine.

Upvotes: 0

Views: 812

Answers (2)

mike.k
mike.k

Reputation: 3457

This came up at the top of my search for the issue, but I didn't want to use nyc.

What worked instead was to put --exit into .mocha.opts.

Upvotes: 0

Valeriy Siestov
Valeriy Siestov

Reputation: 81

You can try to use nyc for this purpose. And test can be run like this

nyc --cache mocha modules/**/*.spec.js routes/*.spec.js --exit

or this

node_modules/.bin/nyc --cache node_modules/.bin/mocha modules/**/*.spec.js routes/*.spec.js --exit

Upvotes: 2

Related Questions