Nodeunit - JSCovrage

358 Views Asked by At


Is there a way to use JSCoverage to have code coverage for nodeunit?

I know there is nodeunit2, but my code is not in lib, and I do not want to restructure my project.

1

There are 1 best solutions below

0
On

Sure... Just follow the steps in this example.

The key elements being:

  1. run the jscoverage command on the directory (or directories) that house your code
  2. Provide some mechanism (such as an environment variable) to make a choice when you include your module to include the correct version of your code
  3. When you want code coverage statistics, set your environment variable accordingly