Sonar coverage integration

I wondered that does sonar have an option for failing when coverage is less than x amount of percentage.
ex) test coverage < 70% = build fail.

I’m reporting javascript and typescript file for getting a report, but could not find any of solution for build failing when coverage is less than 70%.


Welcome to the community!

What you’re looking for is a Quality Gate condition on coverage. (I recommend making it on Coverage on New Code, but that’s up to you.) If you’re using the Sonar way Quality Gate, you won’t be able to edit it. Instead, make a copy (there’s a button at the top-right if you have permissions) and add your condition to the copy. Then set it as your default Quality Gate.