4

I am using nodejs Project repository and the test cases are written in the Jasmine framework. On sonarqube dashboard, I cant see the unit test count block.

Sonar-template-configurations was written as below:

sonar.projectKey={{sonar_projectKey}}
sonar.projectName={{sonar_projectName}}
sonar.host.url={{{sonar_host_url}}}
sonar.javascript.environments = node

# Source code for analysis
sonar.sources=.

sonar.tests = .
sonar.test.inclusions = **/*.spec.js

# Exclusions
sonar.exclusions=test/**

# Reports
sonar.ts.tslint.configPath=tslint.json
sonar.javascript.lcov.reportPaths=coverage/lcov.info
sonar.javascript.coverage.lcovReportPath=coverage/lcov.info
sonar.junit.reportsPath= unit_test_results.xml
sonar.testExecutionReportPaths=unit_test_results.xml
sonar.log.level=DEBUG
sonar.verbose=true

Script used in package.json as below for generating report and running test cases:

"scripts": {
    "start": "nodemon --verbose --ignore '/meta.conf/**' --ignore '/data/**' app.js",
    "test": "nyc ./node_modules/jasmine-xml-reporter/bin/jasmine.js --junitreport --filePrefix=unit_test_results",
    "coverage": "nyc --reporter=lcov --reporter=text-lcov npm test"
  },

Image having missing Unit tests block

Immage having Unit tests block

Does anyone know the solution for it, to show the Unit tests block on the sonarqube dashboard?

Thanks.

Shahaji
  • 175
  • 1
  • 4
  • 14

0 Answers0