Skip to content

JSDOMNodeJSEnv is handled incorrectly (Scalajs support issue) #183

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

Closed
vpavkin opened this issue Sep 27, 2016 · 5 comments · Fixed by #212
Closed

JSDOMNodeJSEnv is handled incorrectly (Scalajs support issue) #183

vpavkin opened this issue Sep 27, 2016 · 5 comments · Fixed by #212

Comments

@vpavkin
Copy link

vpavkin commented Sep 27, 2016

When jsEnv is set to JSDOMNodeJSEnv().value, plugin treats it as PhantomJS environment.

This environment has a window property, so this conditional treats it as PhantomJS:
https://github.com/lustefaniak/scalac-scoverage-plugin/blob/master/scalac-scoverage-runtime/js/src/main/scala/scalajssupport/File.scala#L62

As a consequence - tests fail with:

scala.scalajs.js.JavaScriptException: TypeError: $g.callPhantom is not a function

The conditional should be tweaked somehow (no suggestions yet, so far just reporting).


Steps to reproduce:

  1. Add to build.sbt jsEnv in Test := JSDOMNodeJSEnv().value
  2. npm install jsdom
  3. run tests
@vpavkin
Copy link
Author

vpavkin commented Oct 18, 2016

With 0.6.13 this becomes more real issue, because it affects default run configuration with RequiresDOM := true
https://www.scala-js.org/news/2016/10/17/announcing-scalajs-0.6.13/

@dzhagr
Copy link

dzhagr commented Feb 8, 2017

Running into the same issue with scala.js 0.6.14. Looks like the PhantomJs is a fallback case during runtime interpreter resolution: https://github.com/scoverage/scalac-scoverage-plugin/blob/master/scalac-scoverage-runtime/js/src/main/scala/scalajssupport/File.scala#L62. Is there any better way to determine the runtime interpreter?

@dzhagr
Copy link

dzhagr commented Feb 8, 2017

@vpavkin sorry, just noticed you are pointing to the same code line.

@tannerezell
Copy link

Is there a known workaround for this issue?

@nimaeskandary
Copy link

Has this been fixed/ has a workaround? Am trying to run scoverage and getting at endReadableNT (_stream_readable.js:1106:12) TypeError: $g.callPhantom is not a function

viktor-podzigun added a commit to viktor-podzigun/scalac-scoverage-plugin that referenced this issue Mar 8, 2019
viktor-podzigun added a commit to viktor-podzigun/scalac-scoverage-plugin that referenced this issue Feb 6, 2021
viktor-podzigun added a commit to viktor-podzigun/scalac-scoverage-plugin that referenced this issue May 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants