将业力测试覆盖率纳入Travis CI的正确方法是什么? [英] What is the proper way to get the karma test coverage path into Travis CI?
问题描述
我正在使用 karma 来运行单元测试并生成覆盖率报告.一切正常,但我想将lcov.info
文件从 Travis CI 发布到Code Climate.我已经已完成,并且它效果很好,但该测试运行程序的网址是静态的.
I'm using karma to run unit tests and generate coverage reports. That all works fine but I want to publish the lcov.info
file to Code Climate from Travis CI. I've done it before and it works great, but the url from that test runner was static.
问题在于,业力为其运行的每个实例(例如test/coverage/PhantomJS 1.9.7 (Mac OS X)/lcov.info
)创建一个子文件夹.有没有一种干净的方法可以将该网址输入travis?我不想每次PhantomJS更新时都记得要更新一个硬编码的值.有谁知道.travis.yml
文件是否支持 glob模式之类的东西.
The issue is that karma creates a subfolder for each instance it runs such as test/coverage/PhantomJS 1.9.7 (Mac OS X)/lcov.info
. Is there a clean way to get that url to feed into travis? I don't want to have to remember to update a hardcoded value every time PhantomJS gets updated. Does anyone know if the .travis.yml
file supports something like glob patterns.
有想法吗?
推荐答案
全局模式将起作用,并且我已成功使用karma/travis/codeclimate设置了它.
A glob pattern will work and I'm using it successfully with a karma/travis/codeclimate set up.
使用
codeclimate < test/coverage/**/lcov.info
应该在设置了CODECLIMATE_REPO_TOKEN变量的情况下工作.
should work assuming have the CODECLIMATE_REPO_TOKEN variable set.
此外,还在 https://上讨论了更改子目录结构的选项. github.com/karma-runner/karma-coverage/pull/62 .
这篇关于将业力测试覆盖率纳入Travis CI的正确方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!