Skip to content

Commit

Permalink
Add configuration to run tests in Chrome too.
Browse files Browse the repository at this point in the history
Partially based on http://japgolly.blogspot.com/2016/03/scalajs-firefox-chrome-sbt.html.

Currently not running Chrome in Travis due to
scala-js/scala-js-env-selenium#44. It won't fail the build
appropriately.
I can get Firefox to fail successfully in this project though. Not sure
why the minimal reproduction case is different.
  • Loading branch information
gshakhn committed Apr 16, 2016
1 parent 06c5b84 commit a309deb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ before_script:
script:
- sbt ++$TRAVIS_SCALA_VERSION scalastyle
- sbt ++$TRAVIS_SCALA_VERSION scapegoat
- sbt ++$TRAVIS_SCALA_VERSION 'clean' 'set scalaJSStage in Global := FastOptStage' "client/test"
- sbt ++$TRAVIS_SCALA_VERSION 'clean' 'set scalaJSStage in Global := FullOptStage' "client/test"
- sbt ++$TRAVIS_SCALA_VERSION 'clean' 'set scalaJSStage in Global := FastOptStage' "client/firefox:test"
- sbt ++$TRAVIS_SCALA_VERSION 'clean' 'set scalaJSStage in Global := FullOptStage' "client/firefox:test"
- sbt ++$TRAVIS_SCALA_VERSION "server/test"
sudo: false
cache:
Expand Down
15 changes: 14 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.scalajs.sbtplugin.ScalaJSPluginInternal

scalaVersion in ThisBuild := "2.11.8"

organization in ThisBuild := "com.gshakhn"
Expand Down Expand Up @@ -25,6 +27,9 @@ val reactVersion = "15.0.1"
val bootstrapVersion = "3.3.6"
val jQueryVersion = "2.2.3"

lazy val FirefoxTest = config("firefox") extend Test
lazy val ChromeTest = config("chrome") extend Test

val shared = crossProject.in(file(".")).settings(commonSettings:_*)

lazy val sharedJVM = shared.jvm
Expand All @@ -34,11 +39,11 @@ lazy val sharedJS = shared.js
val client = project.dependsOn(sharedJS)
.settings(commonSettings:_*)
.enablePlugins(ScalaJSPlugin)
.configs(FirefoxTest, ChromeTest)
.settings(
jsDependencies += RuntimeDOM % "test",
skip in packageJSDependencies := false,
scalaJSUseRhino in Global := false,
jsEnv in Test := new org.scalajs.jsenv.selenium.SeleniumJSEnv(org.scalajs.jsenv.selenium.Firefox),
jsDependencies ++= Seq(
"org.webjars" % "jquery" % jQueryVersion / s"$jQueryVersion/jquery.js",
"org.webjars" % "bootstrap" % bootstrapVersion / "bootstrap.js" dependsOn s"$jQueryVersion/jquery.js",
Expand All @@ -54,6 +59,14 @@ val client = project.dependsOn(sharedJS)
"be.doeraene" %%% "scalajs-jquery" % "0.9.0",
"org.scala-js" %%% "scalajs-dom" % "0.9.0",
"org.webjars" % "bootstrap" % bootstrapVersion))
.settings( inConfig(FirefoxTest)(Defaults.testTasks) : _*)
.settings( inConfig(FirefoxTest)(ScalaJSPluginInternal.scalaJSTestSettings) : _*)
.settings( inConfig(ChromeTest)(Defaults.testTasks) : _*)
.settings( inConfig(ChromeTest)(ScalaJSPluginInternal.scalaJSTestSettings) : _*)
.settings( inConfig(FirefoxTest)(
jsEnv := new org.scalajs.jsenv.selenium.SeleniumJSEnv(org.scalajs.jsenv.selenium.Firefox)))
.settings( inConfig(ChromeTest)(
jsEnv := new org.scalajs.jsenv.selenium.SeleniumJSEnv(org.scalajs.jsenv.selenium.Chrome)))

val server = project.dependsOn(sharedJVM)
.settings(commonSettings:_*)
Expand Down

0 comments on commit a309deb

Please sign in to comment.