When I run unit tests for my sbt project (with sbt clean coverage test
), I get code coverage of ~77%.
When I run integration tests (sbt clean coverage it:test
), I get code coverage of ~10%.
When I run both (sbt clean coverage test it:test
), I get code coverage of ~84%.
I'd like to set an aggressive code coverage minimum and fail the build if it's not met, but if I add these build settings:
coverageMinimum := 83
coverageFailOnMinimum := true
...and then run sbt clean coverage test it:test
, the coverage minimum is checked after the unit tests, before the integration tests can run, and the build fails:
[error] Coverage is below minimum [77.0% < 83.0%]
If I put it:test
before test
, it's even worse ([10.0% < 83.0%]
).
Is there any way to stipulate that the 83% minimum should apply only after both unit and integration tests have run? Or am I doomed to setting the coverage minimum meetable by my unit tests alone, and always remembering to put test
before it:test
on the command line?
Automatic post-test coverage minimum check was removed in version 1.3.4 (see issue https://github.com/scoverage/sbt-scoverage/issues/132).
Upgrade plugin version to latest 1.3.5 and call coverageReport
after all tests, e.g.:
sbt clean coverage test it:test coverageReport