我的 Jenkins 作业通过 Sonar Runner 读取由 Istanbul 生成的 lcov 文件。 Istanbul 生成的 lcov-report 中的数字/缺失与 Sonar 中显示的不匹配。通过发现更多未命中, Istanbul 尔更严格,存在 0-7% 的差异。
这是预期的吗?为什么不同?
环境:
- SonarQube 3.5 和 3.7.4
- Sonar 跑者 2.3
- Sonar JavaScript 插件 1.6
- Node.js 代码
最佳答案
单个文件中的覆盖率百分比不匹配应该没有区别,除了四舍五入。至于项目的覆盖率百分比,您需要尝试使用 sonar.exclusions
。这是我们用于特定 Node 项目的内容:
sonar.sources=.
sonar.exclusions=src/**/*,test/**/*,node_modules/**/*,public/**/*,coverage/**/*,html-report/**/*,views/**/*,Gruntfile.js,*.html
sonar.tests=test
关于node.js - Istanbul 尔和 Sonar 之间的分支覆盖率百分比不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23624649/