Skip to content

Use the executable "nodejs" when testing Scala.js. #276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 16, 2016

Conversation

sjrd
Copy link
Member

@sjrd sjrd commented Sep 6, 2016

Scala.js will change its default runner from Rhino to Node.js in 0.6.13 (see scala-js/scala-js#2579). This commit preemptively tests whether this is going to be a problem for the community build.

@sjrd
Copy link
Member Author

sjrd commented Sep 6, 2016

Would it be possible to launch a community build for this PR, so that we can test in advance whether switching to Node.js by default will be fine on this CI infrastructure?

(The PR should not be merged, even if successful; the default will simply change in Scala.js master so it will eventually apply here.)

@adriaanm
Copy link
Contributor

adriaanm commented Sep 6, 2016

Yes, we can!

@SethTisue
Copy link
Member

https://scala-ci.typesafe.com/job/scala-2.11.x-integrate-community-build/294/ says:

[scala-js] java.io.IOException: Cannot run program "node": java.io.IOException: error=2, No such file or directory
[scala-js]  at java.lang.ProcessBuilder.start(ProcessBuilder.java:470)
[scala-js]  at org.scalajs.jsenv.ExternalJSEnv$AbstractExtRunner.startVM(ExternalJSEnv.scala:123)

I guess you want us to install node on the workers, then?

@sjrd
Copy link
Member Author

sjrd commented Sep 7, 2016

Yes, that would be nice, if it isn't too problematic on your side.

FTR on our workers we test with Node.js 4.2.1. Any version at least as recent should work.

@adriaanm
Copy link
Contributor

adriaanm commented Sep 7, 2016

Hmm, I spoke too soon, I guess. How hard is it to get a node.js environment up and running? If it's just a matter of apt-get install, we could look into it this week I guess, otherwise it may have to wait a week or two.

@sjrd
Copy link
Member Author

sjrd commented Sep 7, 2016

It should be just an apt-get install, assuming the distribution contains a recent enough version of Node.js.
Otherwise, it's a matter of extracting a .tgz (downloaded from https://nodejs.org/en/download/) somewhere and put its bin/ directory on the PATH.

@sjrd
Copy link
Member Author

sjrd commented Sep 15, 2016

Any news about this, now that RC1 is out?

SethTisue added a commit to SethTisue/scala-jenkins-infra that referenced this pull request Sep 15, 2016
SethTisue added a commit to SethTisue/scala-jenkins-infra that referenced this pull request Sep 15, 2016
SethTisue added a commit to SethTisue/scala-jenkins-infra that referenced this pull request Sep 15, 2016
@sjrd sjrd force-pushed the scalajs-node-test branch from 8679560 to c182410 Compare September 15, 2016 22:49
@sjrd
Copy link
Member Author

sjrd commented Sep 15, 2016

Updated with setting the name of the executable to "nodejs", after notes from scala/scala-jenkins-infra#187
Note that, due to this, the PR should now actually be merged if it succeeds.

(jsEnv supersedes scalaJSUseRhino, so there's no need for an additional set scalaJSUseRhino in Global := false at this point, even in 0.6.12)

@sjrd sjrd changed the title Test: enable Node.js when testing Scala.js. Use the executable "nodejs" when testing Scala.js. Sep 15, 2016
@SethTisue
Copy link
Member

SethTisue commented Sep 15, 2016

https://scala-ci.typesafe.com/job/scala-2.11.x-integrate-community-build/302/consoleFull failed with

[scala-js] java.lang.RuntimeException: You must install Node.js source map support to run the full Scala.js test suite (npm install source-map-support). To deactivate source map tests, do: set jsEnv in testSuite := NodeJSEnv().value.withSourceMap(false)
[scala-js]  at scala.sys.package$.error(package.scala:27)
[scala-js]  at Build$$anonfun$65.envTagsFor$1(Build.scala:1196)

but it passes (locally) if I add

+        // - save ourselves a `npm install source-map-support` on the workers
+        "set jsEnv in testSuite := NodeJSEnv().value.withSourceMap(false)"

want to throw that in & I'll merge? I'm sure I could figure out whatever additional Chef stuff would be needed to get npm and then source-map-support installed, but I assume just disabling those tests is fine in this context?

@sjrd sjrd force-pushed the scalajs-node-test branch from c182410 to 80ef017 Compare September 16, 2016 07:39
@sjrd
Copy link
Member Author

sjrd commented Sep 16, 2016

Sure, done :)

Scala.js will change its default runner from Rhino to Node.js in
0.6.13 (see scala-js/scala-js#2579).
By default, it looks for an executable called `"node"`, but on
the community build infrastructure, Node.js is called `"nodejs"`.
This commit instructs Scala.js to use `"nodejs"` instead.
@SethTisue SethTisue merged commit 203be01 into scala:2.11.x Sep 16, 2016
@sjrd
Copy link
Member Author

sjrd commented Sep 16, 2016

Thanks!

@sjrd sjrd deleted the scalajs-node-test branch September 16, 2016 22:40
@SethTisue
Copy link
Member

@sjrd it isn't working, https://scala-ci.typesafe.com/job/scala-2.11.x-integrate-community-build/307/consoleFull shows:

[scala-js] java.io.IOException: Cannot run program "node": java.io.IOException: error=2, No such file or directory
[scala-js]  at java.lang.ProcessBuilder.start(ProcessBuilder.java:470)
[scala-js]  at org.scalajs.jsenv.ExternalJSEnv$AbstractExtRunner.startVM(ExternalJSEnv.scala:123)
[scala-js]  at org.scalajs.jsenv.ExternalJSEnv$ExtRunner.run(ExternalJSEnv.scala:153)
[scala-js]  at org.scalajs.sbtplugin.FrameworkDetector.detect(FrameworkDetector.scala:66)
[scala-js]  at org.scalajs.sbtplugin.ScalaJSPluginInternal$$anonfun$60.apply(ScalaJSPluginInternal.scala:732)
[scala-js]  at org.scalajs.sbtplugin.ScalaJSPluginInternal$$anonfun$60.apply(ScalaJSPluginInternal.scala:715)
[scala-js]  at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
[scala-js]  at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
[scala-js]  at sbt.std.Transform$$anon$4.work(System.scala:63)
[scala-js]  at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)

@sjrd
Copy link
Member Author

sjrd commented Sep 19, 2016

Ah! The community build is trying to run the tests of all the projects that need to be compiled, instead of only the projects listed. That's weird, but whatever. So it's trying to run the test for library in addition to testSuite (and I guess testInterface, jUnitRuntime and probably others); but for those we haven't specified to use nodejs instead of node (because I did not expect them to be run).

Well, I guess a follow up PR is coming.

@sjrd
Copy link
Member Author

sjrd commented Sep 19, 2016

#286

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants