The documentation is pretty sparse when filling in using istanbul for integration tests. When I run my mocha tests, I get No coverage information was collected, exit without writing coverage information.
The first thing I do is the tool of all my source code:
✗ istanbul instrument . -o .instrument
In my case, it is a REST microservice, which is Dockerized, which I wrote for Mocha tests to test it after it is deployed. My expectation of istanbul will give me code coverage for the source from this Node service.
In the second step, I run this command to run Node on my tool code:
✗ istanbul cover
After that, I run my tests using the following from the main src directory as follows (with results):
✗ istanbul cover --report none --dir coverage/unit node_modules/.bin/_mocha -- -R spec ./.instrument/test/** --recursive
swagger-tests
✓ should add a new pet (15226ms)
✓ should exist and return an Array (2378ms)
✓ should have at least 1 pet in list (2500ms)
✓ should return error if search not name or id
✓ should be sorted by ID (3041ms)
✓ should be sorted by ID even if no parameter (2715ms)
✓ should be only available pets (2647ms)
✓ should be sorted by name (85822ms)
✓ should delete a pet (159ms)
9 passing (2m)
No coverage information was collected, exit without writing coverage information
When I run istanbul report, he clearly has nothing to report.
What am I missing?
, .