Search code examples
javascriptnode.jsmocha.jsistanbulnyc

Istanbul nyc to include test files


I'm currently testing my coverage with mocha and nyc and I noticed some of my assert calls weren't being called. How can I include my test files in nyc to make sure all the asserts are covered?

I tried:

"nyc": {
  "include": ["**/*.js"]
},

to include every file in the project and

"nyc": {
  "include": ["test/*.js"]
},

to explicitly include the test files, however neither of these included the test files.

How do I include the test files or what is the better way of ensuring all the assert statements are covered?


Solution

  • Tests are excluded in exclude, if you provide an empty exclude it will not exclude the tests

    "nyc": {
      "exclude": []
    }