Unit test count for TypeScript project


Currently my team is using SonarQube.

In Analysis Scope we added test file inclusion (sonar.test.inclusions). We have also added XML coverage report (sonar.javascript.lcov.reportPath). The code and the tests are written in Typescript. In Overall Code tab the coverage of our code looks good except the number of Unit Test is presented as ‘-‘ (screenshot attached). Should we do anything else to get the number of tests displayed correctly?

Hey there.

You’ll need to feed test execution reports to the scanner.

1 Like

I provided the parameters you mentioned in the above link. please check the attached picture.

Jenkins log
14:29:50.780 + /var/Jenkins50/tools/hudson.plugins.sonar.SonarRunnerInstallation/sonar-scanner_3.1.0.1141/bin/sonar-scanner -Dsonar.host.url=https://sonarqube.XXX.net -Dsonar.login=**** -Dsonar.java.coveragePlugin=jacoco -Dsonar.dynamicAnalysis=resuseReports -Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml -Dsonar.language=Typescript -Dsonar.projectName=MSKDAMTT-Analyze-CLI -Dsonar.projectKey=MSKDAMTT-Analyze-CLI -Dsonar.sourceEncoding=UTF-8 -Dsonar.testExecutionReportPaths=/var/Jenkins50/workspace/T_Analyze_for_Zowe_CLI_sonarqube/tests/results/unit/jest-sonar/test-report.xml -Dsonar.javascript.lcov.reportPaths=tests/results/unit/coverage/lcov.info -Dsonar.tests=src -Dsonar.sources=src -Dsonar.branch.name=sonarqube

@Colin did you get a chance to check the configuration I posted?

Is this a bug ? because I also get coverage but Unit test count doesn’t show.