我想在TeamCity上运行istanbul覆盖测试并将测试结果报告回测试选项卡。 我运行以下命令:
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
我在标签代码覆盖率中看到覆盖率结果,但测试未显示在测试选项卡中。我的日志中出现以下错误:
>> Warning: Could not find any test files matching pattern: mocha-teamcity-reporter
可能有什么不对?是否可以对mocha测试运行istanbul覆盖并将测试结果报告给团队城市以进行选项卡测试?
感谢您的帮助!
答案 0 :(得分:2)
参数未传递给mocha。
https://github.com/gotwarlost/istanbul#the-cover-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
或没有全局路径
istanbul cover mocha -- --reporter mocha-teamcity-reporter --require tests_setup.js test/**/*Test.js