1

I am currently working on a Scala.js library intended to be exposed as a JS library. To make my tests run faster I added the option as per scalajs's Basic Tutorial

scalaJSUseRhino in Global := false

However when I run the tests in sbt nothing seems to happen:

clean
project myprojectJS
test
last

Here are the relevant outputs from the last command

[debug] Loading JSEnv with linked file /home/jacob/proj/mastermind/js/target/scala-2.11/mastermind-test-fastopt.js
[debug] Subclass fingerprints: List()
[debug] Annotation fingerprints: List()

Nothing seems to be happening after JSEnv has been loaded.

2 Answers 2

2

The problem was since I was writing a library that'll be exposed as a Javascript module, I had the following config in SBT:

scalaJSOutputWrapper := ("var __ScalaJSEnv = { exportsNamespace: exports };", ""),

Which means the test runner JS file produced will be wrapped too, making the output Javascript file essentially do nothing.

Adding this config in SBT fixes the issue:

scalaJSOutputWrapper in Test := ("", ""),
Sign up to request clarification or add additional context in comments.

Comments

0

ScalaJS tests where not running in my environment, too, as long I was using ScalaTest and UnitTest for a sbt-crossproject.

[debug] Subclass fingerprints: List()
[debug] Annotation fingerprints: List()

both fingerprints where empty lists (running sbt -v -d for verbosity + debug informations)

I switched then to uTest (because of sbt-crossproject), added to my build.sbt settings:

testFrameworks += new TestFramework("utest.runner.Framework"),
libraryDependencies += "com.lihaoyi" %%% "utest" % "0.6.3" % "test"

Now the test log shows...

...
[debug] Loading JSEnv with linked file qqqqq/.js/target/scala-2.11/qqqq-test-fastopt.js
[debug] Starting process: node
[debug] Subclass fingerprints: List((utest.TestSuite,true,org.scalajs.testcommon.Serializer$FingerprintSerializer$$anon$3@12662894))
[debug] Annotation fingerprints: List()
-------------------------------- Running Tests --------------------------------
[debug] Running TaskDef(TutorialTest, org.scalajs.testcommon.Serializer$FingerprintSerializer$$anon$3@60e5e39e, false, [SuiteSelector])
....

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.