我目前正在使用Sonar Qube版本6.1和伊斯坦布尔作为测试运行器。我看到生成了lcov.info文件。以下是它的外观:
TN:
SF:/opt/jenkins_build/workspace/SONAR_QUBE_IMPLEMENTATIONS/Myapp-
CI/public/elements/asset-browser/asset-browser.html
FNF:0
FNH:0
DA:28,2
LF:1
LH:1
BRF:0
BRH:0
end_of_record
TN:
SF:/opt/jenkins_build/workspace/SONAR_QUBE_IMPLEMENTATIONS/Myapp-
CI/public/elements/views/reports-view.html
FNF:0
FNH:0
DA:15,1
LF:1
LH:1
BRF:0
BRH:0
end_of_record
在日志中,我看到下面的错误,当我运行声纳转轮时。
02:18:20.322 INFO - Unit Test Coverage Sensor is started
02:18:20.323 INFO - 1/1 source files have been analyzed
02:18:20.325 INFO - Analysing
[/opt/jenkins_build/workspace/SONAR_QUBE_IMPLEMENTATIONS/Myapp-
CI/coverage/lcov.info]
02:18:20.348 WARN - Could not resolve 2 file paths in
[/opt/jenkins_build/workspace/SONAR_QUBE_IMPLEMENTATIONS/Myapp-
CI/coverage/lcov.info], first unresolved path:
/opt/jenkins_build/workspace/SONAR_QUBE_IMPLEMENTATIONS/Myapp-
CI/public/elements/asset-browser/asset-browser.html
这就是我的sonar.project.properties的样子:
#-- SonarQube server URL
sonar.host.url=http://localhost:9000/sonar
#-- Required Project Properties
sonar.projectKey=Reporting-App
sonar.projectName=Reporting-App
sonar.projectVersion=1.0
sonar.sources=public
#-- Sonar Quality Profile
javascript.sonar.language=js
#-- Report generated in form of
sonar.issuesReport.html.enable=true
sonar.issuesReport.console.enable=true
#-- Specify if any files to include or exclude
sonar.exclusions=tasks/***,public/bower_components/**,public/_index-inline-
loading-script.js
# Encoding of the source files
sonar.sourceEncoding=UTF-8
#-- Coverage Reports
#sonar.javascript.lcov.reportPaths=coverage/lcov.info,coverage/lcov/lcov.info
sonar.javascript.lcov.reportPath=coverage/lcov.info
声纳仪表板显示我的应用程序的O%覆盖率。但是,当我从jenkins访问资产browser.html和reports.html时,它具有正确的覆盖百分比。到目前为止,这对我来说一直是个噩梦。
答案 0 :(得分:2)
您的报告仅包含HTML文件,这些文件不被视为JavaScript文件。仅使用属性sonar.javascript.lcov.reportPath