【问题标题】:Get emberjs code coverage into sonarqube将 emberjs 代码覆盖率纳入 sonarqube
【发布时间】:2016-09-13 20:24:02
【问题描述】:

我正在尝试将我的 ember-addon 项目中的代码覆盖率获取到 sonarqube 中。 CodeCoverage 是使用 ember-cli-blanket 创建的。可以由 SonarQube 运行器导入的 LCOV 文件已创建并填充了覆盖数据,但 sonarrunner(在 jenkins 内部)正在打印以下错误:

SonarQube Runner 2.3
...
15:53:29.949 INFO  - Analysing [/home/build/.jenkins/workspace/$projectname$/$home_dir$/lcov.dat]
15:53:29.970 WARN  - Could not resolve 206 file paths in [/home/build/.jenkins/...
                     first unresolved path: $projectname$/helpers/concat

Job 配置为在 shell 中执行以下命令:

ember test --test-page='tests/index.html?hidepassed&coverage=true'

我浏览项目时,目录结构如下:

-- $projectname$
 |
 |-- app
   |
   |-- helpers
     |
     | - concat.js

LCOV 文件如下所示:

SF:$projectname$/helpers/concat.js
DA:1,1
DA:2,1
... 
LF:9
LH:9
end_of_record

当然,SonarRunner 没有在 LCOV 文件中报告的路径上找到该文件。

我该如何配置它,以使 lcov 文件中的路径正确?

干杯。

【问题讨论】:

    标签: ember.js jenkins sonarqube testem


    【解决方案1】:

    所以,我在 github 上发布了这个问题并得到了答案。解决方案是,使用“sed”手动编辑 lcov 输出。在我的例子中,命令如下所示:

    sed -i -- 's/SF:$oldName$\/\(.*\)/SF:$newName$\/$newPath$\/\1.js/' lcov.dat
    

    【讨论】:

      猜你喜欢
      • 2017-01-25
      • 2019-09-12
      • 2018-01-11
      • 2021-06-04
      • 1970-01-01
      • 2014-08-19
      • 2015-12-28
      • 2013-11-21
      • 2018-11-13
      相关资源
      最近更新 更多