[英]Configuration for Istanbul and mocha Node js code coverage
I am new to Istanbul and mocha Framework. 我是伊斯坦布尔和摩卡框架的新手。
for my Node.js project i am configuring mocha and Istanbul. 对于我的Node.js项目,我正在配置摩卡咖啡和伊斯坦布尔。
it works fine separately. 它单独工作正常。
i don't have an idea how to integrate both and produce the coverage report. 我不知道如何整合两者并生成覆盖率报告。
I found some of the documentation or configuring in Package.json Script for Mac. 我在Mac的Package.json脚本中找到了一些文档或配置文件。
But i need to set up for windows machine. 但是我需要为Windows机器设置。
i have spent enough time researching on my own but i didn't find any perfect doc for it,Can someone help with the proper documentation would be helpful. 我已经花了足够的时间自行研究,但我没有找到任何完善的文档,有人可以提供适当的文档帮助会有所帮助。
Thanks in advance. 提前致谢。
Scripts to be added in package.json for windows : 要在Windows的package.json中添加的脚本:
"scripts": {
"coverage": "istanbul cover ./node_modules/mocha/bin/_mocha test/*.js",
"test": "mocha test/*.js"
}
Command to run the Coverage with UnitTesting : 使用UnitTesting运行Coverage的命令:
npm run coverage
Command to run only the Test Cases: 仅运行测试用例的命令:
npm run test
From the Istanbul website: 从伊斯坦布尔网站:
{
"scripts": {
"test": "nyc mocha"
}
}
https://istanbul.js.org/docs/tutorials/mocha/ https://istanbul.js.org/docs/tutorials/mocha/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.