Closed kontrollanten closed 4 years ago
Why not just move the electron-settings require outside of the beforeEach
directive?
const settings = require('electron-settings');
beforeEach(() => {
// ...
settings.deletAll();
});
Then I get the following error
TypeError: Cannot read property 'app' of undefined
at Object.<anonymous> (.../node_modules/electron-settings/lib/settings.js:26:44)
Which comes from
const app = electron.app || electron.remote.app;
I'm also encountering this issue! Have you found a way to fix this @kontrollanten?
Closing this as it pertains to an older version of Electron Settings. A new major release (v4) of Electron Settings was just released! Electron Settings v4 does have support to define a custom electron instance via configure()
.
I'm implementing e2e tests with Spectron and would like to clear all my settings before each test. When running Spectron the electron instance isn't available via
require('electron')
from Spectron, why it isn't possible to runWould it be possible to add something like
setElectron
to the API? Then it would be:I'm pretty new to Electron and I'm not sure that this is the right approach to solve my problem. But if you agree I'm happy to make a PR.