I use mocha to get unit tests results and istanbul to get code coverage. I'm using grunt to run these tasks. It works fine. I'm also using grunt-sonar-runnerplugin to import these result in sonar. Currently code coverage is imported but that is not the case for unit tests results. During the build, sonar report me this :
20:40:19.410 WARN - Test result will not be saved for test class "Account Controllers User Controller forgot password", because SonarQube associated resource has not been found using file name: "Account Controllers User Controller forgot password.js"
20:40:19.411 WARN - Test result will not be saved for test class "Account Controllers User Controller login", because SonarQube associated resource has not been found using file name: "Account Controllers User Controller login.js"
20:40:19.413 WARN - Test result will not be saved for test class "Account Controllers User Controller logout", because SonarQube associated resource has not been found using file name: "Account Controllers User Controller logout.js"
Because of this, sonar don't save unit tests results. I tryed to change the javascript plugin version in 2.2, or upgrade sonar system in 5.1.1 but the problem is the same. I also try to rename all describe function to form the right path to the file with . between folders (e.g: test.unit.controllers.filename. And I realized that it works for only one test. If you have more than 1 tests, it will not work.
configuration:
* sonar (4.5.2)
* javascript plugin (2.7)
npm modules:
* mocha-sonar-reporter (^0.1.3)
* mocha: (^2.1.0)
* grunt-mocha-test (^0.12.7)