diff --git a/test/modules/environment.js b/test/modules/environment.js index 7ffab88f..e91ade43 100644 --- a/test/modules/environment.js +++ b/test/modules/environment.js @@ -39,6 +39,12 @@ module.exports = { }); }, + createTestUserDataDir() { + if (!fs.existsSync(userDataDir)) { + fs.mkdirSync(userDataDir); + } + }, + getSpectronApp() { return new Application({ path: electronBinaryPath, diff --git a/test/specs/app_test.js b/test/specs/app_test.js index 5e1f237e..6602ae59 100644 --- a/test/specs/app_test.js +++ b/test/specs/app_test.js @@ -8,17 +8,15 @@ describe('application', function desc() { this.timeout(30000); beforeEach(() => { + env.createTestUserDataDir(); env.cleanTestConfig(); this.app = env.getSpectronApp(); }); afterEach(() => { if (this.app && this.app.isRunning()) { - return this.app.stop().then(() => { - env.cleanTestConfig(); - }); + return this.app.stop(); } - env.cleanTestConfig(); return true; });