Running
sbt clean coverage test coverageReport
passes with 100% coverage even though DoubleSpec is commented out.
How can the project be changed so that MainSpec does not affect coverage, while DoubleSpec does?
Use a combination of test tags and a multi-part sbt script. Each time sbt starts, coverage is off. Run
./runtests.sh
Instead of the run script, add a new command testWithSmartCoverage
to build.sbt. Run
sbt testWithSmartCoverage
A more complex terminal command with coverageOff
in the middle:
sbt clean coverage "testOnly * -- -l ExcludeFromCoverage" coverageOff "testOnly * -- -n ExcludeFromCoverage" coverageReport
Kudos to Mario Galic for amazing help on Stackoverflow!