Skip to content
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

scalajs-dom tests started failing on main #3335

Open
Gedochao opened this issue Nov 29, 2024 · 1 comment
Open

scalajs-dom tests started failing on main #3335

Gedochao opened this issue Nov 29, 2024 · 1 comment
Labels
bug Something isn't working internal Internal or build-related changes Scala.js

Comments

@Gedochao
Copy link
Contributor

Version(s)
2859be3

Describe the bug
The scalajs-dom tests on the CI started failing on all platforms, seemingly randomly.
Happens on main.

Example failing test:
https://github.com/VirtusLab/scala-cli/blob/main/modules/integration/src/test/scala/scala/cli/integration/RunScalaJsTestDefinitions.scala#L235

Relevant code that's being run:

//> using dep "org.scala-js::scalajs-dom::2.1.0"

import org.scalajs.dom.document

object JsDom extends App {
  val pSize = document.querySelectorAll("p")
  println("Hello from js dom")
}

Bumping scalajs-dom to 2.8.0 doesn't help.
We run it with:

scala-cli . --js --js-dom

Example failure on the CI:
https://github.com/VirtusLab/scala-cli/actions/runs/12082626617/job/33694519847#step:5:2735

Output:

/Users/runner/work/scala-cli/scala-cli/out/integration/tmpDirBase.dest/working-dir/run-819238814/test-490/node_modules/nwsapi/src/nwsapi.js:215
      var emptyNL = document.createDocumentFragment().childNodes;
                    ^

ReferenceError: document is not defined
    at /Users/runner/work/scala-cli/scala-cli/out/integration/tmpDirBase.dest/working-dir/run-819238814/test-490/node_modules/nwsapi/src/nwsapi.js:215:21
    at Factory (/Users/runner/work/scala-cli/scala-cli/out/integration/tmpDirBase.dest/working-dir/run-819238814/test-490/node_modules/nwsapi/src/nwsapi.js:245:6)
    at initNwsapi (/Users/runner/work/scala-cli/scala-cli/out/integration/tmpDirBase.dest/working-dir/run-819238814/test-490/node_modules/jsdom/lib/jsdom/living/helpers/selectors.js:10:10)
    at exports.addNwsapi (/Users/runner/work/scala-cli/scala-cli/out/integration/tmpDirBase.dest/working-dir/run-819238814/test-490/node_modules/jsdom/lib/jsdom/living/helpers/selectors.js:38:24)
    at DocumentImpl.querySelector (/Users/runner/work/scala-cli/scala-cli/out/integration/tmpDirBase.dest/working-dir/run-819238814/test-490/node_modules/jsdom/lib/jsdom/living/nodes/ParentNode-impl.js:68:21)
    at exports.documentBaseURL (/Users/runner/work/scala-cli/scala-cli/out/integration/tmpDirBase.dest/working-dir/run-819238814/test-490/node_modules/jsdom/lib/jsdom/living/helpers/document-base-url.js:8:30)
    at exports.parseURLToResultingURLRecord (/Users/runner/work/scala-cli/scala-cli/out/integration/tmpDirBase.dest/working-dir/run-819238814/test-490/node_modules/jsdom/lib/jsdom/living/helpers/document-base-url.js:41:27)
    at HTMLScriptElementImpl._fetchExternalScript (/Users/runner/work/scala-cli/scala-cli/out/integration/tmpDirBase.dest/working-dir/run-819238814/test-490/node_modules/jsdom/lib/jsdom/living/nodes/HTMLScriptElement-impl.js:74:17)
    at HTMLScriptElementImpl._eval (/Users/runner/work/scala-cli/scala-cli/out/integration/tmpDirBase.dest/working-dir/run-819238814/test-490/node_modules/jsdom/lib/jsdom/living/nodes/HTMLScriptElement-impl.js:165:12)
    at HTMLScriptElementImpl._attach (/Users/runner/work/scala-cli/scala-cli/out/integration/tmpDirBase.dest/working-dir/run-819238814/test-490/node_modules/jsdom/lib/jsdom/living/nodes/HTMLScriptElement-impl.js:49:12)

Node.js v20.18.1
Exception in thread "main" org.scalajs.testing.common.RPCCore$ClosedException: org.scalajs.testing.adapter.JSEnvRPC$RunTerminatedException
	at org.scalajs.testing.common.RPCCore.helpClose(RPCCore.scala:223)
	at org.scalajs.testing.common.RPCCore.close(RPCCore.scala:215)
	at org.scalajs.testing.adapter.JSEnvRPC.close(JSEnvRPC.scala:69)
	at org.scalajs.testing.adapter.JSEnvRPC.$anonfun$new$1(JSEnvRPC.scala:60)
	at org.scalajs.testing.adapter.JSEnvRPC.$anonfun$new$1$adapted(JSEnvRPC.scala:60)
	at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:484)
	at java.base@17.0.6/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395)
	at java.base@17.0.6/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base@17.0.6/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base@17.0.6/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base@17.0.6/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base@17.0.6/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
	at com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:775)
	at com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:203)
Caused by: org.scalajs.testing.adapter.JSEnvRPC$RunTerminatedException
	... 11 more
Caused by: org.scalajs.jsenv.ExternalJSRun$NonZeroExitException: exited with code 1
	at org.scalajs.jsenv.ExternalJSRun$$anon$1.run(ExternalJSRun.scala:200)
	... 2 more

To Reproduce
To run locally, use:

 ./mill -i integration.test.jvm '*Js DOM'

Note that the test is only enabled for the CI, have to enable it for local when setting up.

Expected behaviour
Should run successfully as before.

cc @sjrd

@Gedochao Gedochao added bug Something isn't working Scala.js internal Internal or build-related changes labels Nov 29, 2024
@sjrd
Copy link

sjrd commented Nov 29, 2024

Looks like it's a bug in a new version of nwsapi. Fix incoming:
dperini/nwsapi#134

If it appeared in the CI without any change, it means the repo's probably missing some dependency pinning with a package-lock.json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working internal Internal or build-related changes Scala.js
Projects
None yet
Development

No branches or pull requests

2 participants