Add spec for electron module require
This commit is contained in:
parent
19fd841c30
commit
fe0ec67623
4 changed files with 48 additions and 1 deletions
|
@ -3,7 +3,8 @@ const child_process = require('child_process')
|
|||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const os = require('os')
|
||||
const remote = require('electron').remote
|
||||
const {remote} = require('electron')
|
||||
const {BrowserWindow, ipcMain} = remote
|
||||
|
||||
describe('node feature', function () {
|
||||
var fixtures = path.join(__dirname, 'fixtures')
|
||||
|
@ -228,4 +229,33 @@ describe('node feature', function () {
|
|||
require('vm').runInNewContext('')
|
||||
})
|
||||
})
|
||||
|
||||
describe.only('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'))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue