Reputation: 216
I have a node application with separate sister folders and accompanying package.json files for the application code and tests.
Project
|
|-----Application
|-----app.js
|-----package.json
|-----Tests
|
|-------test.js
|-------package.json (nyc added here)
nyc is included as a dependency(along with mocha) in the test folder. It fails to show coverage for files in the application folder. I have tried to explicitly include application files by including "../Application/**/*.js" in the nyc config, bit that does not seem to do the trick.
Any ideas?
Upvotes: 3
Views: 3176
Reputation: 216
I found out that you can do this by using an obscure option called cwd as follows:
"nyc": {
"all": true,
"check-coverage": true,
"per-file": true,
"lines": 99,
"statements": 99,
"functions": 99,
"branches": 99,
**"cwd" : "../",**
"exclude" : [
"Tests/**/*.js"
]
}
Upvotes: 7