Javascript 0.0% Coverage

I have just installed SonarQube and SonarScanner for the first time to try it out.

I have a node web project, so HTML, CSS & JS. First question, can I limit the scanner to only those languages, there’s no need to test for C#, Java, VB etc, not important but a nice to have.

I ran the scanner for the first time which passed the quality gates and found lots of bugs, great. I corrected a couple of bugs and scanned again to see the results, great again.

Now my problem, I continued to fix more bugs and scan but ever since that third scan I get a “Failed” and 0.0% coverage on new code. I’ve tried for hours to fix it but I’m lost. I’ve gone down the path of assuming I need to getup sonar.javascript.lcov.reportPaths with an file, but thats all new to me and I’ve not come accross any clus as to how to create a file.

Any help will be welcome, the bug numbers are coming down but I’m really stuck with the 0.0% coverage.

The scanner should automatically limit itself to analysing the languages of files it is setup to analyze. I would suggest reading over the Narrowing the Focus documetnation.

SonarQube consumes coverage reports, it does not generate them – are you already writing tests for your code? A quick Google search for javascript coverage reporter brings up the tools I hear about the most often related to Javascript and Code Coverage, Istanbul and Karma. Surely there are others.

If you’re not currently writing tests for your code (no time like the present!), you may find you want to remove the Code Coverage condition from the Quality Gate assigned to your project.