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

installJsdom may installs jsdom outside of the target directory #416

Open
unarist opened this issue Apr 12, 2022 · 0 comments
Open

installJsdom may installs jsdom outside of the target directory #416

unarist opened this issue Apr 12, 2022 · 0 comments

Comments

@unarist
Copy link
Contributor

unarist commented Apr 12, 2022

installJsdom seems to install jsdom into target.value / "scalajs-bundler-jsdom".

installJsdom := {
val installDir = target.value / "scalajs-bundler-jsdom"
val baseDir = baseDirectory.value

However, it may install into other directory if:

  • default install directory target.value / "scalajs-bundler-jsdom" does not exists, and
  • any its ancestor directory has one of:
    • node_modules directory (even if it's empty)
    • package.json file

This behavior unexpectedly edits other file which is not related to Scala project. Also, simultaneous installJsdom execution from sbt projects sometimes fails due to writing same node_modules directory.

For a workaround, I'm thinking about overriding installJsdom task.

Reproducing steps

  1. Prepare sbt project with following files
  2. Run npm init -y to create empty package.json
  3. Run sbt test
  4. ... then I expected there is no node_modules directory in the root directory, but it exists

/project/plugins.sbt

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.3.0")
addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0")

/build.sbt

scalaVersion := "2.12.11"
enablePlugins(ScalaJSBundlerPlugin)
Test / requireJsDomEnv := true
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

1 participant