Search code examples
scalasbtscalatestscoverage

How to break the build if test coverage fails minimum threshold?


We want to fail the build on codeship if test coverage goes below the threshold value. But it is not failing the build.

Scoverage Plugin:

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.3.5")

Added following two statements in build.sbt

coverageMinimum := 80,
coverageFailOnMinimum := true

It is not failing even in local if test coverage is below 80. The command I run is

sbt clean coverage test coverageReport

Solution

  • Try upgrading to version 1.5.1 like so

    addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1")