-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use global scope for jacoco settings
This makes it easier for users to configure as they don't need to scope using 'jacocoXX in Test'
- Loading branch information
1 parent
c66bb08
commit d5d68ec
Showing
8 changed files
with
68 additions
and
5 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
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
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,18 @@ | ||
name := "jacocoTest" | ||
organization := "com.navetas" | ||
|
||
scalaVersion := "2.10.4" | ||
scalacOptions ++= Seq("-deprecation", "-optimize", "-unchecked", "-Xlint", "-language:_") | ||
|
||
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.4" % "test" | ||
|
||
jacocoReportSettings in Test := JacocoReportSettings() | ||
.withThresholds( | ||
JacocoThresholds( | ||
instruction = 100, | ||
method = 100, | ||
branch = 100, | ||
complexity = 100, | ||
line = 100, | ||
clazz = 100) | ||
) |
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 @@ | ||
{ | ||
val pluginVersion = System.getProperty("plugin.version") | ||
if (pluginVersion == null) | ||
throw new RuntimeException("""|The system property 'plugin.version' is not defined. | ||
|Specify this property using the parameter -Dplugin.version=<version>""".stripMargin) | ||
|
||
else addSbtPlugin("com.github.sbt" % "sbt-jacoco" % pluginVersion) | ||
} |
8 changes: 8 additions & 0 deletions
8
src/sbt-test/sbt-jacoco/simple-scoped/src/main/scala/jacocotest/TestClass.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 @@ | ||
package jacocotest | ||
|
||
case class TestClass( val x : Int ) | ||
{ | ||
def double() : Int = x * 2 | ||
|
||
def triple() : Int = x * 3 | ||
} |
11 changes: 11 additions & 0 deletions
11
src/sbt-test/sbt-jacoco/simple-scoped/src/test/scala/jacocotest/TestClassTests.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,11 @@ | ||
package jacocotest | ||
|
||
import org.scalatest.FlatSpec | ||
|
||
class TestClassTests extends FlatSpec | ||
{ | ||
"TestClass" should "double a number correctly" in | ||
{ | ||
assert( new TestClass( 2 ).double === 4 ) | ||
} | ||
} |
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,13 @@ | ||
> clean | ||
|
||
# coverage should fail | ||
-> jacoco | ||
|
||
# instrumented classes | ||
$ exists target/scala-2.10/jacoco/instrumented-classes | ||
|
||
# results | ||
$ exists target/scala-2.10/jacoco/data/jacoco.exec | ||
|
||
# html report | ||
$ exists target/scala-2.10/jacoco/report/html/index.html |
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