I've built a single-page app off of chentsulin's electron/react boilerplate, which comes with the following node script for testing:
"test": "cross-env NODE_ENV=test BABEL_DISABLE_CACHE=1 mocha --compilers js:babel-register --recursive --require ./test/setup.js test/**/*.spec.js"
const app = electron.app || electron.remote.app;
TypeError: Cannot read property 'app' of undefined
The problem was that I was using mocha (which came as part of the Electron-React boilerplate). Installing electron-mocha and changing the
test script in the package.json resolved this problem immediately.