Skip to content

Commit bbe6d53

Browse files
authored
Add support for JSDOM JSEnv (#456)
* Setup JSDOM in the build * Add support for JSDOM * Shuffling and fixing * More fixes, runs on JSDOM :) * Formatting * Formatting * Use %%% * Add JSDOM to CI * Add runtimeJSDOMTest to root aggregate * Add npm package.json and lockfile * Update CONTRIBUTING, .gitignore w/ npm stuff
1 parent 971d01f commit bbe6d53

File tree

10 files changed

+1118
-20
lines changed

10 files changed

+1118
-20
lines changed

Diff for: .github/workflows/ci.yml

+3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ jobs:
3939
distribution: 'temurin'
4040
java-version: ${{ matrix.java }}
4141

42+
- name: Install JSDOM
43+
run: npm install
44+
4245
- name: run tests
4346
run: sbt ++${{ matrix.scala.version }} plugin/test
4447

Diff for: .gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,7 @@ credentials.sbt
1818
# IntelliJ IDEA specific
1919
.idea
2020
.idea_modules
21-
*.iml
21+
*.iml
22+
23+
# npm specific
24+
node_modules/

Diff for: CONTRIBUTING.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Contributing
22

3+
To run the tests, you will first need to run `npm install`. This will
4+
install the JSDOM dependency used to run some of the Scala.js tests.
5+
36
When working in the code base it's a good idea to utilize the
47
`.git-blame-ignore-revs` file at the root of this project. You can add it
58
locally by doing a:

Diff for: build.sbt

+20-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ lazy val sharedSettings = List(
8585
scalacOptions.value
8686
}
8787
},
88-
libraryDependencies += "org.scalameta" %% "munit" % munitVersion % Test
88+
libraryDependencies += "org.scalameta" %%% "munit" % munitVersion % Test
8989
)
9090

9191
lazy val root = Project("scalac-scoverage", file("."))
@@ -94,7 +94,15 @@ lazy val root = Project("scalac-scoverage", file("."))
9494
publishArtifact := false,
9595
publishLocal := {}
9696
)
97-
.aggregate(plugin, runtime.jvm, runtime.js, reporter, domain, serializer)
97+
.aggregate(
98+
plugin,
99+
runtime.jvm,
100+
runtime.js,
101+
runtimeJSDOMTest,
102+
reporter,
103+
domain,
104+
serializer
105+
)
98106

99107
lazy val runtime = CrossProject(
100108
"runtime",
@@ -118,6 +126,16 @@ lazy val runtime = CrossProject(
118126
lazy val `runtimeJVM` = runtime.jvm
119127
lazy val `runtimeJS` = runtime.js
120128

129+
lazy val runtimeJSDOMTest =
130+
project
131+
.enablePlugins(ScalaJSPlugin)
132+
.dependsOn(runtimeJS % "test->test")
133+
.settings(
134+
publishArtifact := false,
135+
publishLocal := {},
136+
jsEnv := new org.scalajs.jsenv.jsdomnodejs.JSDOMNodeJSEnv()
137+
)
138+
121139
lazy val plugin =
122140
project
123141
.dependsOn(runtimeJVM % Test)

0 commit comments

Comments
 (0)