Istanbul instruments your ES5 and ES2015+ JavaScript code with line counters,so that you can track how well your unit-tests exercise your codebase.
Thenyc command-line-client for Istanbulworks well with most JavaScript testing frameworks:tap,mocha,AVA,etc.
Adding coverage to your mocha tests could not be easier
Now, simply place the commandnyc in front of your existing test command, for example:
{"scripts": {"test":"nyc mocha" }}