2 years ago

#39431

test-img

Lindsey

Sonarqube coverage report is missing the number of unit tests

Sonarqube is currently reporting the percent coverage of the project, but not the number of unit tests. I am using jest-sonar-reporter, so a test-report.xml file is being generated after tests run. Looking that the Sonarqube log, it says test execution data is imported for 0 files.

INFO: Parsing /builds/REPONAME/coverage/test-report.xml
INFO: Imported test execution data for 0 files
INFO: Test execution data ignored for 153 unknown files, including:
*file names*

The file paths in my test-report.xml file are:

<file path="/builds/REPONAME/src/accounts/.../utils.test.ts">
<file path="/builds/REPONAME/src/shared/.../utils.test.js">
etc.

package.json file:

  "devDependencies": {
    ...
    "jest-sonar-reporter": "2.0.0",
    ...
  },
  "jestSonar": {
    "reportPath": "coverage",
    "reportFile": "test-report.xml",
    "indent": 4
  },

sonar-project.properties file:

sonar.projectName=REPONAME
sonar.projectVersion=3.46.1
sonar.language=js
sonar.sources=src
sonar.tests=src
sonar.exclusions=node_modules/**,tests/**,.idea/**,.storybook/**,stories/**
sonar.javascript.lcov.reportPaths=coverage/lcov.info
sonar.test.inclusions=**/*.test.*
sonar.coverage.exclusions=node_modules/**,test/**,src/**/*.test.js,src/**/*.test.jsx,server/**/*.test.js,*.config.js,.idea/**,.storybook/**,stories/**,**/__snapshots__/**/*
sonar.eslint.reportPaths=eslint.json
sonar.testExecutionReportPaths=coverage/test-report.xml

javascript

jestjs

sonarqube

sonarqube-scan

test-reporting

0 Answers

Your Answer

Accepted video resources