Skip to content

Commit

Permalink
Setup lucuma-jsdom for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
armanbilge committed Dec 27, 2024
1 parent e87ecd6 commit b4184cb
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 26 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ jobs:
if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false'
run: sbt +update

- name: Setup Node
if: matrix.project == 'rootJS'
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm

- run: npm ci

- name: Check that workflows are up to date
run: sbt githubWorkflowCheck

Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
yarn.lock
.tags*
.java-version
package.json
package-lock.json
metals.sbt
.bloop/

Expand Down Expand Up @@ -70,7 +68,6 @@ smartgcal
.jvmopts
# Node modules
node_modules/
package-lock.json

# Nix
.direnv/
34 changes: 12 additions & 22 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import org.scalajs.linker.interface.OutputPatterns

Global / onChangedBuildSource := ReloadOnSourceChanges

ThisBuild / crossScalaVersions := List("3.6.2")
ThisBuild / tlBaseVersion := "0.47"

ThisBuild / tlCiReleaseBranches := Seq("master")

ThisBuild / githubWorkflowBuildPreamble ++= Seq(
WorkflowStep.Use(
UseRef.Public("actions", "setup-node", "v4"),
name = Some("Setup Node"),
params = Map("node-version" -> "22", "cache" -> "npm"),
cond = Some("matrix.project == 'rootJS'")
),
WorkflowStep.Run(List("npm ci"))
)

lazy val root = tlCrossRootProject.aggregate(core, testkit, tests)

lazy val core = crossProject(JVMPlatform, JSPlatform)
Expand Down Expand Up @@ -55,26 +63,8 @@ lazy val tests = crossProject(JVMPlatform, JSPlatform)
libraryDependencies ++= {
Settings.Libraries.ScalaJSReactTest.value.map(_ % Test)
},
// libraryDependencies ++= Seq(
// ("org.webjars.npm" % "react" % "18.3.1" % Test).intransitive(),
// ("org.webjars.npm" % "react-dom" % "18.3.1" % Test).intransitive()
// ),
// jsEnv := new org.scalajs.jsenv.jsdomnodejs.JSDOMNodeJSEnv()
jsEnv := new org.scalajs.jsenv.jsdomnodejs.JSDOMNodeJSEnv(
org.scalajs.jsenv.jsdomnodejs.JSDOMNodeJSEnv
.Config()
.withEnv(
Map(
"NODE_PATH" -> (baseDirectory.value / "node_modules").absolutePath
)
)
),
Test / scalaJSLinkerConfig ~= {
// Enable ECMAScript module output.
_.withModuleKind(ModuleKind.ESModule)
// Use .mjs extension.
.withOutputPatterns(OutputPatterns.fromJSFile("%s.mjs"))
}
jsEnv := new lucuma.LucumaJSDOMNodeJSEnv(),
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) }
)
// .jsSettings(
// Defaults.itSettings: _*
Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
addSbtPlugin("edu.gemini" % "sbt-lucuma-lib" % "0.12.4")

libraryDependencies += "org.scala-js" %% "scalajs-env-jsdom-nodejs" % "1.1.0"
libraryDependencies += "edu.gemini" %% "lucuma-jsdom" % "0.12.4"

0 comments on commit b4184cb

Please sign in to comment.