admin管理员组文章数量:1426058
I have a node application with separate sister folders and acpanying 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?
I have a node application with separate sister folders and acpanying 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?
Share Improve this question asked Nov 20, 2018 at 18:14 arinrayarinray 2162 silver badges14 bronze badges1 Answer
Reset to default 7I 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"
]
}
本文标签: javascriptEnabling nycistanbul code coverage for files outside the package directoryStack Overflow
版权声明:本文标题:javascript - Enabling nycistanbul code coverage for files outside the package directory - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745388695a2656494.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论