How to test rule: “Failed unit tests should be fixed”?


I just set up sonarqube 7.7 with sonar scanner for a typescript project and i was wondering how i can test the rule: “Failed unit tests should be fixed”?

Write a failing unit test!

If your build can’t get proceed to SonarQube analysis without succeeding in all tests, this rule probably won’t do anything for you.

Hi Collin,

I’m currently using mocha for unit testing, would I be able to be able to run or somehow scan the unit testing results to Sonarqube with that? I was able to generate an file and scan that to display the coverages.

You should generate generic test execution report (property sonar.testExecutionReportPaths).
Rule relies on the data in that report.
I found this package mocha-sonar-generic-test-coverage to convert mocha report to sonarqube-compatible