SonarQube unit tests with jest not showing up on dashboard

SonarQube version: 9.9.1 developer version (build 69595)

we have our unit tests done with jest and we want to have the numbers of unit test in the sonarqube dashboard.

We run the tests first and then run the sonarscanner with “sonar.junit.reportPaths=junit.xml” in the sonar-project.properties. The coverage works but the unit tests are not being shown.
We have also tried sonar.tests instead of sonar.junit.reportPaths and it didn’t work

our junit.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="jest tests" tests="1087" failures="0" time="87.037">
    <testsuite name="DatepickerBtn" errors="0" failures="0" skipped="0" timestamp="2023-09-21T08:28:24" time="1.938" tests="6">
        <testcase classname="DatepickerBtn Snapshots shows the correct UI Elements"
            name="DatepickerBtn Snapshots shows the correct UI Elements" time="0.112">
        </testcase>
    </testsuite>
</testsuites>

any help is appreciated

Hi,

Welcome to the community!

SonarQube won’t count your tests for you. You need to provide a test execution report.

 
HTH,
Ann