8

I am using jest-sonar-reporter for the coverage as below:

package.json

{
    "name": "app",
    "version": "1.0.0",
    "description": "The task runner packages for Gulp",
    "main": "gulpfile.js",
    "scripts": {
        ...
        "test": "jest --coverage",
        ...
    },
"devDependencies": {
   ...
    "jest": "26.0.1",
    "jest-sonar-reporter": "2.0.0",
    ...
    },
    "jest": {
        ...
        "collectCoverage": true,
        "testResultsProcessor": "jest-sonar-reporter"
    },
    "jest-junit": {
        "suiteName": "jest tests",
        ...
    }
}

I have the test-report.xml file generated after npm run test as below:

test-report.xml

<?xml version="1.0" encoding="UTF-8"?>
<testExecutions version="1">
  <file path="<path to>\AreaList.test.jsx">
    <testCase name="Description 1 " duration="6"/>
  </file>
  <file path="<path to>\selectors.search.test.js">
    <testCase name="Description 2 " duration="2"/>
  </file>
</testExecutions>

SonarScanner command:

sonar-scanner.bat -Dsonar.host.url="http://localhost:9000" -Dsonar.projectKey="Project-A" -Dsonar.projectName="Project-A" -Dsonar.sourceEncoding=UTF-8 -Dsonar.testExecutionReportPaths="\test-report.xml"

I am getting error as:

INFO: Parsing <path to>\test-report.xml
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 5:29.011s
INFO: Final Memory: 15M/68M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
ERROR: Error during parsing of generic test execution report '<path to>\test-report.xml'. Look at the SonarQube documentation to know the expected XML format.
ERROR: Caused by: Line 3 of report refers to a file which is not configured as a test file: <path to>\AreaList.test.jsx 

Am I missing any configuration?

Appreciate your response. Thank you.

skyboyer
  • 22,209
  • 7
  • 57
  • 64
helloworld9
  • 173
  • 2
  • 2
  • 8
  • 1
    First thing to try is to net search the non-specific part of your error message, which finds this: https://stackoverflow.com/questions/57466369/sonarqube-test-report-report-refers-to-a-file-which-is-not-configured-as-a-test . Does that help? – David M. Karr Nov 13 '20 at 14:49
  • any solutions ? – msahin Apr 15 '21 at 13:35

0 Answers0