I’m building an Electron application that make use of a native module. Currently, I rebuild any native modules in a postinstall-hook after running
npm install. This works great.
Unfortunately, this has the side affect that any tests that depend on this module will fail due to it being built for Electron and not my local version of Node. Running
npm rebuild solves the problem and tests are passing again but now starting the Electron application fail due to the native module being built for my local Node version instead.
As you can imagine, this becomes pretty tedious. A solution would be to use something like https://github.com/facebook-atom/jest-electron-runner. This works but running tests become much slower.
Is there an alternative approach here, that I seem to be missing?