diff --git a/README.md b/README.md index 7629779..e1838fc 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,8 @@ Test project for https://github.com/scoverage/scalac-scoverage-plugin/issues/183 Run `npm install jsdom` before building. + +Run all the tests and see the coverage: +```bash +sbt clean coverage test coverageReport && sbt coverageAggregate +``` diff --git a/build.sbt b/build.sbt index 7afb6ab..445e6de 100644 --- a/build.sbt +++ b/build.sbt @@ -10,8 +10,26 @@ lazy val cross = CrossProject("test", file("."))(JVMPlatform, JSPlatform) .jsSettings( libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "0.9.3", scalaJSStage := FastOptStage, - jsEnv := new org.scalajs.jsenv.jsdomnodejs.JSDOMNodeJSEnv() + + // uncomment to test with corresponding env + // it works out of the box for these envs + // + //jsEnv := new org.scalajs.jsenv.nodejs.NodeJSEnv() + //jsEnv := new org.scalajs.jsenv.rhino.RhinoJSEnv(withDOM = true) + + // not tested !!! + // + //jsEnv := new org.scalajs.jsenv.phantomjs.PhantomJSEnv() + + //!!! requires patching !!! for exposing `global` object + // see for example: https://github.com/scalacenter/scalajs-bundler/pull/198/files + // + //jsEnv := new org.scalajs.jsenv.jsdomnodejs.JSDOMNodeJSEnv() + + // works with scalajs-bundler with PR: https://github.com/scalacenter/scalajs-bundler/pull/198 + // + requireJsDomEnv in Test := true ) -lazy val crossJS = cross.js +lazy val crossJS = cross.js.enablePlugins(ScalaJSBundlerPlugin) lazy val crossJVM = cross.jvm diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 0000000..7609b47 --- /dev/null +++ b/project/build.properties @@ -0,0 +1 @@ +sbt.version = 1.2.8 \ No newline at end of file diff --git a/project/plugins.sbt b/project/plugins.sbt index 40e209e..d58fc9a 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,9 @@ + +resolvers += "Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/" + +//use patched versions by now, to make scoverage work with scalajs-bundler +addSbtPlugin(("org.scommons.patched" % "sbt-scalajs-bundler" % "0.14.0-SNAPSHOT").force()) + addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.26") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.5.0")