问题描述
我们有一个 Jenkins 作业,其中包含一堆 javascript 文件.我们通过 grunt 构建我们的项目,并在构建结束时运行 JSCover 来运行我们的单元测试并收集代码覆盖率.这一切都有效.我们得到了一个不错的 LCOV 文件.
We have a Jenkins job that contains a bunch of javascript files. We build our project via grunt, and at the end of the build we run JSCover to run our unit tests and collect code coverage. It all works. We get a nice LCOV file.
我们现在想将 LCOV 文件上传到 Sonar,但我不知道该怎么做.我们正在将 Jenkins 项目构建为一个自由风格的项目.
We now want to upload the LCOV file to Sonar, and I'm not sure how to do this. We are building our project from Jenkins as a free style project.
我尝试使用各种声纳项目属性,但不喜欢:
I tried playing around with various project properties for sonar, but no love:
# project metadata (required)
sonar.projectKey=my.project
sonar.projectName=My Project
sonar.projectVersion=1.0
# path to source directories (required)
sonar.sources=src
# The value of the property must be the key of the language.
sonar.language=java (I tried js and javascript, but no love. Plugin is not installed. Actually, I don't care about the language, since I am already generating the LCOV file during the build. I just need Sonar to use this LCOV file.)
# Advanced parameters
sonar.javascript.jstestdriver.reportsfolder=target/surefire-reports
sonar.javascript.jstestdriver.coveragefile=target/test-coverage/jscover.lcov
sonar.dynamicAnalysis=reuseReports
我怀疑问题出在高级参数"下,但我不知道如何告诉 Sonar,请使用我的 LCOV 文件进行代码覆盖".
I suspect the problem is under the "Advanced Parameters", but I don't know how to tell Sonar, "Please use my LCOV file for Code Coverage".
推荐答案
你可以看看此示例项目,其中 LCOV 报告的路径在 sonar-project.properties 文件中指定.
You can have a look at this sample project where the path to a LCOV report is specified in the sonar-project.properties file.
请注意,在 Javascript 插件的最新版本中,一些属性名称已更改.
Note that some property names have changed in the last version of the Javascript plugin.
这篇关于如何告诉 Sonar 使用我的 LCOV 文件进行代码覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)