Skip to content

Commit 5478e8a

Browse files
committed
Remove scoverage for now
The `coverageEnabled := true` in `build.sbt` instruments the code unconditionally. The right way to enable coverage is to do `sbt clean coverageOn test coverageReport coverageAggregate` Also it is important to do `sbt clean` after doing the coverage, otherwise the code stay instrumented. The problems to figure out: 1. when instrumented code is included into jar this jar doesn't work on another machine 2. apparently the `sbt clean` is not sufficient and the `target` directories for each subproject need to be removed 3. setting `coverageEnabled := false` and trying to issue `sbt clean coverageOn ...` doesn't produce report files 4. when `sbt ... coverageOn test` is used junit xml test report is not generated 5. we should run eunit tests using coverage as well ``` sbt clean coverageOn make all-tests sbt coverageReport coverageAggregate ``` 6. we need to include mango tests into all-tests target See following - scoverage/sbt-scoverage#84 - scoverage/sbt-scoverage#228 - scoverage/sbt-scoverage#306 - https://github.com/viktortnk/kafka-storm-starter/blob/de6eac4ae635e0e54981a92555de05071c14518a/README.md?plain=1#L340C1-L342C58 - https://github.com/Facsimile/facsimile/blob/409dd67fd291161414401c97d128bf65c0fcc30f/Facsimile.sbt#L458
1 parent 736bec3 commit 5478e8a

File tree

4 files changed

+0
-21
lines changed

4 files changed

+0
-21
lines changed

Makefile

-14
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,7 @@ all-tests: test zeunit
134134

135135
.PHONY: test
136136
# target: test - Run all Scala tests
137-
# coverage is commented out due to conflict in dependencies it can be enabled
138-
# when we update zio-config
139137
test: build $(ARTIFACTS_DIR)
140-
@#sbt clean coverage test
141138
@sbt clean test
142139
@$(call to_artifacts,test-reports)
143140

@@ -159,17 +156,6 @@ check-deps: build $(ARTIFACTS_DIR)
159156
@find .
160157
@$(call to_artifacts,dependency-check-report.*)
161158

162-
.PHONY: cover
163-
# target: cover - Generate code coverage report, options: TEST=<sub-project>
164-
cover: build
165-
ifeq ($(TEST),)
166-
@sbt coverage +test +coverageReport +coverageAggregate
167-
@open target/scala-$(SCALA_SHORT_VERSION)/scoverage-report/index.html
168-
else
169-
@sbt coverage +${TEST}/test +${TEST}/coverageReport
170-
@open ${TEST}/target/scala-$(SCALA_SHORT_VERSION)/scoverage-report/index.html
171-
endif
172-
173159
.PHONY: meta
174160
meta: build $(ARTIFACTS_DIR)
175161
@sbt makeBom

build.sbt

-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ lazy val commonSettings = Seq(
7272
if (sys.props.getOrElse("jartest", "false").toBoolean) (Test / fullClasspath).value else Seq()
7373
),
7474
assemblyPackageScala / assembleArtifact := false,
75-
coverageEnabled := true,
7675
testFrameworks := Seq(new TestFramework("com.novocode.junit.JUnitFramework")),
7776
dependencyCheckAssemblyAnalyzerEnabled := Some(false),
7877
dependencyCheckFormats := Seq("XML", "JSON"),

core/src/test/scala/com/cloudant/ziose/core/RegistrySpec.scala

-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
/*
2-
* $ sbt coverage "testOnly com.cloudant.ziose.core.RegistrySpec"
3-
* $ sbt coverageReport "testOnly com.cloudant.ziose.core.RegistrySpec"
4-
* $ open core/target/scala-2.13/scoverage-report/index.html
5-
*/
61
package com.cloudant.ziose.core
72

83
import org.junit.runner.RunWith

project/plugins.sbt

-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
44
addSbtPlugin("io.github.siculo" %% "sbt-bom" % "0.3.0")
55
addSbtPlugin("net.vonbuchholtz" % "sbt-dependency-check" % "5.1.0")
66
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
7-
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.9")
87
//addSbtPlugin("uk.co.josephearl" % "sbt-findbugs" % "2.0.0")

0 commit comments

Comments
 (0)