exoego / scala-js-env-jsdom-nodejs

jsdom + Node.js require capability

Version Matrix

scalajs-env-jsdom-nodejs

This is a fork of scalajs-env-jsdom-nodejs providing a JavaScript environment for Scala.js (a JSEnv) running Node.js with jsdom, and with require function which allows to require/import Node.js modules (e.g. fs).

You may find require function useful when you need to read/write files during testing, for example.

When working with Node.js modules, scala-js-nodejs might be handy since it provide types and utility functions.

Usage

Ensure jsdom@16.3.0 or above is installed.

Add the following line to project/plugins.sbt:

libraryDependencies += "net.exoego" %% "scalajs-env-jsdom-nodejs" % "2.1.0"

and the following line to build.sbt (possibly in the settings/jsSettings of Scala.js projects):

jsEnv := new net.exoego.jsenv.jsdomnodejs.JSDOMNodeJSEnv()