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

Support for JS modules #56

Open
xko opened this issue May 22, 2023 · 3 comments
Open

Support for JS modules #56

xko opened this issue May 22, 2023 · 3 comments

Comments

@xko
Copy link

xko commented May 22, 2023

After completing the initial vite tutorial, I started looking for the way to UT the actual DOM generated. JsDom was recomended by older tutorial, so I gave it a try. It failed with:

org.scalajs.jsenv.UnsupportedInputException: Unsupported input: List(ESModule(C:\Users\xko\dev\sueppchen\target\scala-3.2.2\sueppchen-test-fastopt\main.js))

IMO it's likely to confuse many new users.
Since the modular config is now the default, would be nice to have it supported here.
If not, what's currently the best approach to the DOM testing?

@sjrd
Copy link
Member

sjrd commented May 22, 2023

jsdom itself does not support ECMAScript modules: jsdom/jsdom#2475
Until it does, there is nothing we can do here.

You may want to try https://github.com/scala-js/scala-js-env-selenium instead.

@xerial
Copy link

xerial commented Jul 2, 2023

@sjrd I've tried Selenium to run Scala.js tests using DOM, but I encountered another issue reported in scala-js/scala-js-env-selenium#128 It seems ESModule can't be used with Selenium probably because module files are accessed using relative paths.

@xerial
Copy link

xerial commented Jul 2, 2023

ok. I've found a workaround to use Scala.js + jsdom + Selenium Chrome Driver. Leaving an example project here, which works with Vite, ScalablyTyped, Selenium, jsdom: https://github.com/xerial/scalajs-selenium

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

No branches or pull requests

3 participants