We have a Jenkins job that contains a bunch of javascript files. We build our project via grunt, and at the end of the build we run JSCover to run our unit tests and collect code coverage. It all works. We get a nice LCOV file, and we get a bunch of TEST-*.xml in the target/surefire-reports/ directory.
Sonar displays the code coverage results, but it doesn't show the number of tests that passed/failed or even executed.
How do I tell sonar to use the surefire reports? I thought by setting this property, it would consume it, but no love:
sonar.surefire.reportsPath=target/surefire-reports
Here is my project properties file:
# project metadata (required)
sonar.projectKey=pure.cloud.browser.app
sonar.projectName=Pure Cloud Browser App
sonar.projectVersion=1.0
# path to source directories (required)
sonar.sources=src
sonar.exclusions=js/lib/**,js/test/lib/**,js/test/tools/**
# The value of the property must be the key of the language.
sonar.language=js
# Advanced parameters
sonar.surefire.reportsPath=target/surefire-reports
sonar.javascript.lcov.reportPath=target/test-coverage/jscover.lcov
sonar.dynamicAnalysis=reuseReports
Thank you, Fabrice, for recommending me the following link in my previous question: https://github.com/SonarSource/sonar-examples/tree/master/projects/languages/javascript/javascript-sonar-runner-JsTestDriver but I can't find a way to tell Sonar to somehow display the unit test results (number of tests, number of failures, etc) that are stored in the surefire-reports directory.
Any ideas?
With Sonar Javascript 1.3, "sonar.surefire.reportsPath" has been replaced by "sonar.javascript.jstestdriver.reportsPath".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With