I managed to achieve this by following these steps.
Get javascript junit reports in sonar
- find and download
sonar-karma-test-report-plugin-1.0.0.4.jar , which is not available through the update center - put the jar file in
/usr/local/Cellar/sonar/5.3/libexec/extensions/plugins and restart the sonar Tell karma to omit browser name
junitReporter: { useBrowserName: false }
Get Karma to create a junit xml file using the regular karma-junit-reporter and ask him to call the TESTS-xunit.xml (I had a file called test-results.xml , but the sonar did not detect its WTF)
In sonar-project.properties file sonar.javascript.karmajstestdriver.reportsPath=reports/js/unit-components/results/
- call
sonar-runner
Sonar requires a test file path to process the report. Jasmine does not make this available to the reporter. My understanding is that the sonar plugin iterates over the xml file and finds the class name for each test that has a test name (i.e. my cool tests ) and replaces the line to change it to the file location
source share