Skip to content

Add support for JSDOM JSEnv #456

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 11 commits into from
May 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ jobs:
distribution: 'temurin'
java-version: ${{ matrix.java }}

- name: Install JSDOM
run: npm install

- name: run tests
run: sbt ++${{ matrix.scala.version }} plugin/test

Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ credentials.sbt
# IntelliJ IDEA specific
.idea
.idea_modules
*.iml
*.iml

# npm specific
node_modules/
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Contributing

To run the tests, you will first need to run `npm install`. This will
install the JSDOM dependency used to run some of the Scala.js tests.

When working in the code base it's a good idea to utilize the
`.git-blame-ignore-revs` file at the root of this project. You can add it
locally by doing a:
Expand Down
22 changes: 20 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ lazy val sharedSettings = List(
scalacOptions.value
}
},
libraryDependencies += "org.scalameta" %% "munit" % munitVersion % Test
libraryDependencies += "org.scalameta" %%% "munit" % munitVersion % Test
)

lazy val root = Project("scalac-scoverage", file("."))
Expand All @@ -94,7 +94,15 @@ lazy val root = Project("scalac-scoverage", file("."))
publishArtifact := false,
publishLocal := {}
)
.aggregate(plugin, runtime.jvm, runtime.js, reporter, domain, serializer)
.aggregate(
plugin,
runtime.jvm,
runtime.js,
runtimeJSDOMTest,
reporter,
domain,
serializer
)

lazy val runtime = CrossProject(
"runtime",
Expand All @@ -118,6 +126,16 @@ lazy val runtime = CrossProject(
lazy val `runtimeJVM` = runtime.jvm
lazy val `runtimeJS` = runtime.js

lazy val runtimeJSDOMTest =
project
.enablePlugins(ScalaJSPlugin)
.dependsOn(runtimeJS % "test->test")
.settings(
publishArtifact := false,
publishLocal := {},
jsEnv := new org.scalajs.jsenv.jsdomnodejs.JSDOMNodeJSEnv()
)

lazy val plugin =
project
.dependsOn(runtimeJVM % Test)
Expand Down
Loading