debuggingintellij-ideascala.jsutest

How can I debug scala.js unit tests?


I have some scala.js unit tests written in utest. They all run just fine from the sbt build, however I would like to be able to step through the unit tests in a debugger. Using my favorite IDE (intellij) to debug the tests won't work because it will try to run them on the JVM. Is there some way to step through the unit test execution similar to how you can step through the (javascript) application code in browsers like chrome?


Solution

  • Currently, the only way to (step-by-step) debug Scala.js code I know of, is inside a browser. You can generate an HTML runner for your tests in sbt:

    sbt> testHtmlFastOpt
    // snip
    [info] Wrote HTML test runner. Point your browser to .../test-suite-fastopt-test.html
    

    This works starting Scala.js 0.6.10.