Closed mariotacke closed 8 years ago
@mariotacke I think what you trying to achieve with this library is not possible. Maybe you should provide a dummy electron module for all your tests or use https://github.com/jprichardson/electron-mocha. Could this be a solution for you?
I'm trying to test a file with a default export which imports a non-existing dependency. It does not exist at this time because webpack targets a specific environment (
electron
in my case) during my actual build. When I try to run the test, it breaks on the import because the dependency does not exist yet.Is there a way to rewire the dependency before it actually loads the file? I used proxyquire before which worked in a similar way.
I run mocha tests like this:
./node_modules/.bin/mocha --compilers js:babel-core/register
It fails with
Cannot find module 'doesnt-exist'
, naturally.someFunction.js
test.js
.babelrc