Closed hoefling closed 5 years ago
karma
runs in the browser context of Electron, not the main process section. While require
works fine, fs
needs a hoop or 2 to jump through. I believe require('electron').remote.require('fs')
should work
Another way to handle this is by adding browserify
with a brfs
transform to your transform step. This will inline sync commands like readdirSync
and readFileSync
to show their results. Though this might interfere with require
usage by forcing bundling =/
I guess this is an issue similar to #27, however I double-checked the Karma configuration. I have prepared a sample repository reproducing the issue:
So basically, when I do
the module is not resolved in tests. The current workaround I'm using is using
window.require
:What should I change in
karma.conf.js
in the above example in order to be able to importfs
as usual?