Jenkins integration with SonarQube sonar.testExecutionReportPaths

Based on documentation :

I want to create a report with my Javascript unit test files.

I’ve added propery in Jenkins file:

This generate a file with the results of my unit tests with the following format:

<testExecutions version="1">
  <file path="testx/ClassOneTest.js">
    <testCase name="test1" duration="5"/>
    <testCase name="test2" duration="500">
      <skipped message="short message">other</skipped>

Then I run this script to create my xml file.
"mocha --reporter node_modules/mocha-sonarqube-reporter content/scripts/test --reporter-options output=unit-tests.xml

In the deployment output file I confirm the xml is read but I get this error:

INFO: Sensor Generic Test Executions Report
INFO: Parsing C:\Jenkins\workspace\Connect_Pipeline\Backoffice\unit-tests.xml
INFO: Imported test execution data for 0 files
INFO: Test execution data ignored for 5 unknown files, including:

Ignoring my unit test JavaScript files.
I’ve tried different paths and still got the same error.


Welcome to the community!

This is going to be about matching the path-to-file that analysis sees to the path-to-file in the report. Presumably the paths in your report should start from analysis root (i.e. the directory analysis runs in).