-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #377 from ckipp01/disabled
Ensure reporting and aggregation still works when disabling modules.
- Loading branch information
Showing
11 changed files
with
101 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/sbt-test/scoverage/aggregate-disabled-module/a/src/main/scala/a/AdderScala.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package a | ||
|
||
object AdderScala { | ||
|
||
def add(x: Int, y: Int) = x + y | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
src/sbt-test/scoverage/aggregate-disabled-module/a/src/test/scala/AdderTestSuite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import munit.FunSuite | ||
import a.AdderScala | ||
|
||
class AdderTestSuite extends FunSuite { | ||
test("Adder should sum two numbers") { | ||
assertEquals(AdderScala.add(1, 2), 3) | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/sbt-test/scoverage/aggregate-disabled-module/b/src/main/scala/b/AdderScala.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package b | ||
|
||
object AdderScala { | ||
|
||
def add(x: Int, y: Int) = x + y | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
src/sbt-test/scoverage/aggregate-disabled-module/b/src/test/scala/AdderTestSuite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import munit.FunSuite | ||
import b.AdderScala | ||
|
||
class AdderTestSuite extends FunSuite { | ||
test("Adder should sum two numbers") { | ||
assertEquals(AdderScala.add(1, 2), 3) | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/sbt-test/scoverage/aggregate-disabled-module/build.sbt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
inThisBuild( | ||
List( | ||
organization := "org.scoverage", | ||
scalaVersion := "2.13.6", | ||
libraryDependencies += "org.scalameta" %% "munit" % "0.7.25" % Test | ||
) | ||
) | ||
|
||
lazy val a = project | ||
lazy val b = project | ||
lazy val c = project.disablePlugins(ScoverageSbtPlugin) | ||
|
||
ThisBuild / resolvers ++= { | ||
if (sys.props.get("plugin.version").exists(_.endsWith("-SNAPSHOT"))) | ||
Seq(Resolver.sonatypeRepo("snapshots")) | ||
else Seq.empty | ||
} |
7 changes: 7 additions & 0 deletions
7
src/sbt-test/scoverage/aggregate-disabled-module/c/src/main/scala/c/AdderScala.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package c | ||
|
||
object AdderScala { | ||
|
||
def add(x: Int, y: Int) = x + y | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
src/sbt-test/scoverage/aggregate-disabled-module/c/src/test/scala/AdderTestSuite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import munit.FunSuite | ||
import c.AdderScala | ||
|
||
class AdderTestSuite extends FunSuite { | ||
test("Adder should sum two numbers") { | ||
assertEquals(AdderScala.add(1, 2), 3) | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
src/sbt-test/scoverage/aggregate-disabled-module/project/build.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sbt.version=1.5.5 |
16 changes: 16 additions & 0 deletions
16
src/sbt-test/scoverage/aggregate-disabled-module/project/plugins.sbt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
val pluginVersion = sys.props.getOrElse( | ||
"plugin.version", | ||
throw new RuntimeException( | ||
"""|The system property 'plugin.version' is not defined. | ||
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin | ||
) | ||
) | ||
|
||
addSbtPlugin("org.scoverage" % "sbt-scoverage" % pluginVersion) | ||
|
||
resolvers ++= { | ||
if (pluginVersion.endsWith("-SNAPSHOT")) | ||
Seq(Resolver.sonatypeRepo("snapshots")) | ||
else | ||
Seq.empty | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# run scoverage using the coverage task | ||
> clean | ||
> coverage | ||
> test | ||
# There should be scoverage-data directory | ||
$ exists a/target/scala-2.13/scoverage-data | ||
$ exists b/target/scala-2.13/scoverage-data | ||
$ absent c/target/scala-2.13/scoverage-data | ||
> coverageReport | ||
# There should be scoverage-report directory | ||
$ exists a/target/scala-2.13/scoverage-report | ||
$ exists b/target/scala-2.13/scoverage-report | ||
$ absent c/target/scala-2.13/scoverage-report | ||
> coverageAggregate | ||
# There should be a root scoverage-report directory | ||
$ exists target/scala-2.13/scoverage-report |