My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

ExpressJs: Istanbul coverage report with mocha

Atul Joshi's photo
Atul Joshi
·Apr 16, 2017

I tried to get a coverage report for my test cases, and installed istanbul, My coverage report works fine for a single test file that is in root folder, else I get “No coverage information was collected, exit without writing coverage information”

My folder structure is

app/ 
 — node_modules/
 — coverage/
 — server/
 — —  app.js
 — test/
 — — index.test.js
 — test.js

When I run

istanbul cover _mocha test.js

I get a coverage report however If I try to tun

istanbul cover _mocha test/*.js

or

istanbul cover _mocha test/index.test.js

I don’t get any coverage report I tried all hit and trial its not working any work around for the same?

How can I run istanbul to cover report for all the test cases recursively ?