gotwarlost / istanbul

Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale.
Other
8.7k stars 785 forks source link

How to cover another package.json script? #860

Open MickeyKay opened 6 years ago

MickeyKay commented 6 years ago

I'd like to be able to do something like this in package.json:

"scripts": {
  "test": "mocha --recursive --require some/bootstrap/file",
  "test-cov": "istanbul cover npm run test"
}

Based on my reading/testing, however, it doesn't seem like this is possible since cover expects a file, as opposed to an actual command. Is there any way to achieve this without having to abstract the test script out into a separate file?