Hi there,
I’m using SonarQube Community Edition 8.3.1, I have a Javascript based code and when execute the npm test (jest --coverage) is creating the coverage files, however when setting the ‘sonar.javascript.lcov.reportPaths=coverage/lcov.info’ is not displaying the coverage % in the UI, here are my details about the environment
jest
1- npm i -D jest-sonar-reporter
2- npm i jest
sonar-project.properties
sonar.projectKey=sonar-jest-test
sonar.sources=src
sonar.tests=tests
sonar.javascript.lcov.reportPaths=coverage/lcov.info
sonar.testExecutionReportPaths=test-report.xml
package.json
{
- “name”: “xxxxx”,*
- “version”: “1.0.0”,*
- “description”: “”,*
- “main”: “src/index.js”,*
- “scripts”: {*
- “test”: “jest --coverage”*
- },*
- “repository”: {*
- “type”: “git”,*
- “url”: “xxxxxxxxxx”*
- },*
- “author”: “”,*
- “license”: “ISC”,*
- “jest”: {*
- “testResultsProcessor”: “jest-sonar-reporter”*
- }*
}
coverage folder
+ cat coverage/lcov.info
TN:
SF:tests/sum.js
FN:1,sum
FNF:1
FNH:1
FNDA:1,sum
DA:2,1
DA:5,1
LF:2
LH:2
BRF:0
BRH:0
end_of_record
Project in UI
Can you please help on address where can be the issue, or a guide about best practices on unit testing for javascript using Jest?
Appreciate your comments,
Regards