[英]Istanbul coverage + mocha + teamcity reporter
I would like to run tests with istanbul coverage on TeamCity and report test results back to the Tests tab. 我想在TeamCity上运行伊斯坦布尔覆盖的测试,并将测试结果报告回“测试”选项卡。 I run the following command:
我运行以下命令:
node --harmony C:\...\node_modules\istanbul\lib\cli.js cover C:\...\node_modules\mocha\bin\_mocha --reporter mocha-teamcity-reporter --require C:\...\tests_setup.js C:\...\test\**\*Test.js && node --harmony C:\...\istanbul\lib\cli.js report teamcity
I see coverage results in my tab Code Coverage, but tests are not shown in the tab Tests. 我在“代码覆盖率”选项卡中看到覆盖率结果,但是“测试”选项卡中未显示测试。 I have the following error in my logs:
我的日志中出现以下错误:
>> Warning: Could not find any test files matching pattern: mocha-teamcity-reporter
What could be wrong ? 有什么问题吗? Is it possible to run istanbul coverage for mocha tests and report test results back to the teamcity for the tab Tests ?
是否可以运行伊斯坦布尔覆盖范围的摩卡测试,并将测试结果报告给Teamcity以使用“测试”选项卡?
Thanks for your help! 谢谢你的帮助!
The parameters are not being passed to mocha. 参数未传递给摩卡。
https://github.com/gotwarlost/istanbul#the-cover-command https://github.com/gotwarlost/istanbul#the-cover-command
You need to add --
to pass parameters to the covered command 您需要添加
--
才能将参数传递给涵盖的命令
node --harmony C:\...\node_modules\istanbul\lib\cli.js cover \
C:\...\node_modules\mocha\bin\_mocha -- \
--reporter mocha-teamcity-reporter \
--require C:\...\tests_setup.js C:\...\test\**\*Test.js
or without global paths 或没有全局路径
istanbul cover mocha -- --reporter mocha-teamcity-reporter --require tests_setup.js test/**/*Test.js
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.