File tree Expand file tree Collapse file tree 7 files changed +75
-0
lines changed
src/sbt-test/scoverage/scalajs Expand file tree Collapse file tree 7 files changed +75
-0
lines changed Original file line number Diff line number Diff line change 1+ lazy val root = (project in file(" ." )).aggregate(crossJS, crossJVM)
2+
3+ lazy val cross = crossProject.in(file(" sjstest" )).settings(
4+ scalaVersion := " 2.11.7" ,
5+ libraryDependencies ++= Seq (
6+ " org.scalatest" %%% " scalatest" % " 3.0.0-M15" % " test"
7+ )
8+ )
9+
10+
11+ lazy val crossJS = cross.js
12+ lazy val crossJVM = cross.jvm
Original file line number Diff line number Diff line change 1+ // The Typesafe repository
2+ resolvers += " Typesafe repository" at " http://repo.typesafe.com/typesafe/releases/"
3+
4+ // scoverage needs this
5+ resolvers += Classpaths .sbtPluginReleases
6+
7+ {
8+ val pluginVersion = System .getProperty(" plugin.version" )
9+ if (pluginVersion == null )
10+ throw new RuntimeException (""" |The system property 'plugin.version' is not defined.
11+ |Specify this property using the scriptedLaunchOpts -D.""" .stripMargin)
12+ else addSbtPlugin(" org.scoverage" %% " sbt-scoverage" % pluginVersion)
13+ }
14+
15+ addSbtPlugin(" org.scala-js" % " sbt-scalajs" % " 0.6.8" )
Original file line number Diff line number Diff line change 1+ import org .scalatest .{FlatSpec , Matchers }
2+
3+ class JsTest extends FlatSpec with Matchers {
4+
5+ " JS UnderTest" should " work on JS" in {
6+ UnderTest .jsMethod shouldBe " js"
7+ }
8+
9+ }
10+
Original file line number Diff line number Diff line change 1+ import org .scalatest .{FlatSpec , Matchers }
2+
3+ class JvmTest extends FlatSpec with Matchers {
4+
5+ " JVM UnderTest" should " work on JVM" in {
6+ UnderTest .jvmMethod shouldBe " jvm"
7+ }
8+
9+ }
10+
Original file line number Diff line number Diff line change 1+
2+ object UnderTest {
3+ def onJsAndJvm : String = " js and jvm"
4+
5+ def jsMethod : String = " js"
6+
7+ def jvmMethod : String = " jvm"
8+ }
Original file line number Diff line number Diff line change 1+ import org .scalatest .{FlatSpec , Matchers }
2+
3+ class SharedTest extends FlatSpec with Matchers {
4+
5+ " Shared UnderTest" should " return where it works" in {
6+ UnderTest .onJsAndJvm shouldBe " js and jvm"
7+ }
8+
9+ }
Original file line number Diff line number Diff line change 1+ # run scoverage using the coverage task
2+ > clean
3+ > coverage
4+ > test
5+ # There should be scoverage-data directory
6+ $ exists sjstest/js/target/scala-2.11/scoverage-data
7+ $ exists sjstest/jvm/target/scala-2.11/scoverage-data
8+ > coverageReport
9+ # There should be scoverage-report directory
10+ $ exists sjstest/js/target/scala-2.11/scoverage-report
11+ $ exists sjstest/jvm/target/scala-2.11/scoverage-report
You can’t perform that action at this time.
0 commit comments