keynmol / http4s-laminar-stack

A complete example of a fullstack (I actually don't know what this means) Scala application, using http4s on the backend and Laminar and Scala.js on the frontend
66 stars 11 forks source link

frontend/test broken? #5

Closed Quafadas closed 3 years ago

Quafadas commented 3 years ago

I cloned the projects and attempted to run the tests.

The frontend throws an exception claiming that it cannot find jsdom. Would this be expected?

sbt:root> frontend/ Test / loadedTestFrameworks
internal/modules/cjs/loader.js:883
  throw err;/ scalaJSLinkerImpl / fullClasspath 0s
  ^

Error: Cannot find module 'jsdom'
Require stack:
- /Users/simon/Code/laminar_full_stack/[stdin]
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at codeWithJSDOMContext.js:3:15
    at codeWithJSDOMContext.js:52:3
    at Script.runInThisContext (vm.js:133:18)
    at Object.runInThisContext (vm.js:310:38)
    at [stdin]:8:29
    at Script.runInThisContext (vm.js:133:18) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/Users/simon/Code/laminar_full_stack/[stdin]' ]
}
[error] stack trace is suppressed; run last frontend / Test / loadedTestFrameworks for the full output
[error] (frontend / Test / loadedTestFrameworks) org.scalajs.testing.common.RPCCore$ClosedException: org.scalajs.testing.adapter.JSEnvRPC$RunTerminatedException
[error] Total time: 1 s, completed 14 Apr 2021, 17:01:56
keynmol commented 3 years ago

Hi! This is omission from the readme, in fact :)

Frontend tests are run using jsdom (https://www.npmjs.com/package/jsdom) which simulates browser DOM model

You can install it via npm install jsdom (or whatever you prefer). It's one of the steps in CI: https://github.com/keynmol/http4s-laminar-stack/runs/1921446169?check_suite_focus=true#step:5:1

I'll welcome a PR adding this information to the README :)

Quafadas commented 3 years ago

Thanks for the pointer. Have submitted PR...