purescript-spec/purescript-spec-discovery

Cannot find module '...' when running with Spago

justinlovinger opened this issue · 4 comments

An error such as the following occurs when spec-discovery attempts to require any module, when tests are run with spago test.

spago test
Installation complete.
Build succeeded.
module.js:557
    throw err;
    ^

Error: Cannot find module 'Test.Spec'
    at Function.Module._resolveFilename (module.js:555:15)
    at Function.Module._load (module.js:482:25)
    at Module.require (module.js:604:17)
    at require (internal/module.js:11:18)
    at [PROJECT_PATH]\output\Test.Spec.Discovery\foreign.js:15:18
    at Array.map (<anonymous>)
    at getMatchingModules ([PROJECT_PATH]\output\Test.Spec.Discovery\foreign.js:14:6)
    at [PROJECT_PATH]\output\Test.Spec.Discovery\foreign.js:22:12
    at __do ([PROJECT_PATH]\output\Test.Spec.Discovery\index.js:16:44)
    at Object.__do [as main] ([PROJECT_PATH]\output\Test.Main\index.js:9:54)
spago.exe: Tests failed: 1

It looks like spec-discovery assumes the node root is the 'output' folder, which seems untrue with 'spago'. Perhaps using absolute paths to require each module will fix this.

Ouch, just ran into this too. :(

OK, I've merged #11 and released a new version. Please try with https://pursuit.purescript.org/packages/purescript-spec-discovery/3.2.0.

Works great! Thanks @owickstrom and @reactormonk

Awesome!