Thursday, August 10, 2017
ScalaJS
Testing Scala.JS on Firefox & Chrome from SBT
Goals
In my ideal environment:- I write my Scala.JS unit tests the same way I already do, and I can continue to run them against Node.JS or Phantom.JS because it's fast. No changes there.
- To run tests against Firefox or Chrome, I simply prefix my SBT command with
firefox:
orchrome:
.
For example,firefox:test
would run tests in Firefox,chrome:testOnly a.b.c
would run mya.b.c
test in Chrome. - Testing in FF/Chrome doesn't require recompilation (All in the Land know Scalac is slow). It should use all of the same bits and bobs (especially the output JS) that normal tests use.
- I specify that certain tests will only run in FF and/or Chrome.
For example, tests that use focus should skip Phantom.JS where I know focus doesn't work. - I run
testAll
to run the same tests in all environments (fast-env & Firefox & Chrome). This will happen concurrently. - I can use FF/Chrome headlessly (i.e. without the windows popping up when the browsers are launched and running).