diff --git a/spec/api-app-spec.js b/spec/api-app-spec.js index c0469cc3f68f..df356ecb9053 100644 --- a/spec/api-app-spec.js +++ b/spec/api-app-spec.js @@ -3,10 +3,9 @@ const ChildProcess = require('child_process') const https = require('https') const fs = require('fs') const path = require('path') -const remote = require('electron').remote +const {remote} = require('electron') -const app = remote.require('electron').app -const BrowserWindow = remote.require('electron').BrowserWindow +const {app, BrowserWindow, ipcMain} = remote const isCI = remote.getGlobal('isCi') describe('electron module', function () { @@ -15,6 +14,36 @@ describe('electron module', function () { require('clipboard') }, /Cannot find module 'clipboard'/) }) + + describe('require("electron")', function () { + let window = null + + beforeEach(function () { + if (window != null) { + window.destroy() + } + window = new BrowserWindow({ + show: false, + width: 400, + height: 400 + }) + }) + + afterEach(function () { + if (window != null) { + window.destroy() + } + window = null + }) + + it('always returns the internal electron module', function (done) { + ipcMain.once('answer', function () { + done() + }) + window.loadURL('file://' + path.join(__dirname, 'fixtures', 'api', 'electron-module-app', 'index.html')) + }) + }) + }) describe('app module', function () { diff --git a/spec/node-spec.js b/spec/node-spec.js index a164288f7904..71fdbac98664 100644 --- a/spec/node-spec.js +++ b/spec/node-spec.js @@ -4,7 +4,6 @@ const fs = require('fs') const path = require('path') const os = require('os') const {remote} = require('electron') -const {BrowserWindow, ipcMain} = remote describe('node feature', function () { var fixtures = path.join(__dirname, 'fixtures') @@ -229,33 +228,4 @@ describe('node feature', function () { require('vm').runInNewContext('') }) }) - - describe('require("electron")', function () { - let window = null - - beforeEach(function () { - if (window != null) { - window.destroy() - } - window = new BrowserWindow({ - show: false, - width: 400, - height: 400 - }) - }) - - afterEach(function () { - if (window != null) { - window.destroy() - } - window = null - }) - - it('always returns the internal electron module', function (done) { - ipcMain.once('answer', function () { - done() - }) - window.loadURL('file://' + path.join(__dirname, 'fixtures', 'api', 'electron-module-app', 'index.html')) - }) - }) })