Closed dougluce closed 8 years ago
"electron-mocha": "^2.3.0", "electron-prebuilt": "^1.2.6" should it matter.
Yes that's to be expected: electron-mocha runs your tests in electron's main process, or, if you pass --renderer
in a renderer process. In both cases, electron-mocha is responsible for starting and initializing electron. When your tests run, electron has already been initialized, so the ready
event has fired before you start listening for it.
Cool, that makes some sense. This worked:
const {BrowserWindow} = require('electron')
it('makes a window', function (done) {
const options = { frame: false, height: 768, width: 1024, x: 0, y: 0, show: false }
const win = new BrowserWindow(options)
win.webContents.once('did-stop-loading', function () {
win.webContents.savePage('out.html', 'HTMLOnly', done)
})
win.loadURL('http://cnn.com')
})
This code:
when run with electron-mocha gives a Mocha timeout error (
Ensure the done() callback is being called in this test.
).Is this expected?