dance around error checking with this one weird trick
This commit is contained in:
parent
5e4696f4a7
commit
c5f70c8d99
3 changed files with 14 additions and 10 deletions
|
@ -80,24 +80,28 @@ describe('debugger module', function () {
|
||||||
try {
|
try {
|
||||||
w.webContents.debugger.attach()
|
w.webContents.debugger.attach()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
done('unexpected error : ' + err)
|
return done('unexpected error : ' + err)
|
||||||
}
|
}
|
||||||
|
/* eslint-disable */
|
||||||
|
// standard expects callback errors to be handled,
|
||||||
|
// but for some reason this err is not actually null..
|
||||||
var callback = function (err, res) {
|
var callback = function (err, res) {
|
||||||
assert(!res.wasThrown)
|
assert(!res.wasThrown)
|
||||||
assert.equal(res.result.value, 6)
|
assert.equal(res.result.value, 6)
|
||||||
w.webContents.debugger.detach()
|
w.webContents.debugger.detach()
|
||||||
done()
|
done()
|
||||||
}
|
}
|
||||||
|
/* eslint-enable */
|
||||||
const params = {
|
const params = {
|
||||||
'expression': '4+2',
|
'expression': '4+2'
|
||||||
}
|
}
|
||||||
w.webContents.debugger.sendCommand('Runtime.evaluate', params, callback)
|
w.webContents.debugger.sendCommand('Runtime.evaluate', params, callback)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('fires message event', function (done) {
|
it('fires message event', function (done) {
|
||||||
var url = process.platform != 'win32' ?
|
var url = process.platform !== 'win32'
|
||||||
'file://' + path.join(fixtures, 'pages', 'a.html') :
|
? 'file://' + path.join(fixtures, 'pages', 'a.html')
|
||||||
'file:///' + path.join(fixtures, 'pages', 'a.html').replace(/\\/g, '/')
|
: 'file:///' + path.join(fixtures, 'pages', 'a.html').replace(/\\/g, '/')
|
||||||
w.webContents.loadURL(url)
|
w.webContents.loadURL(url)
|
||||||
try {
|
try {
|
||||||
w.webContents.debugger.attach()
|
w.webContents.debugger.attach()
|
||||||
|
@ -105,7 +109,7 @@ describe('debugger module', function () {
|
||||||
done('unexpected error : ' + err)
|
done('unexpected error : ' + err)
|
||||||
}
|
}
|
||||||
w.webContents.debugger.on('message', function (e, method, params) {
|
w.webContents.debugger.on('message', function (e, method, params) {
|
||||||
if (method == 'Console.messageAdded') {
|
if (method === 'Console.messageAdded') {
|
||||||
assert.equal(params.message.type, 'log')
|
assert.equal(params.message.type, 'log')
|
||||||
assert.equal(params.message.url, url)
|
assert.equal(params.message.url, url)
|
||||||
assert.equal(params.message.text, 'a')
|
assert.equal(params.message.text, 'a')
|
||||||
|
|
|
@ -60,7 +60,7 @@ describe('ipc module', function () {
|
||||||
|
|
||||||
it('can construct an object from its member', function () {
|
it('can construct an object from its member', function () {
|
||||||
var call = remote.require(path.join(fixtures, 'module', 'call.js'))
|
var call = remote.require(path.join(fixtures, 'module', 'call.js'))
|
||||||
var obj = new call.constructor
|
var obj = new call.constructor // eslint-disable-line
|
||||||
assert.equal(obj.test, 'test')
|
assert.equal(obj.test, 'test')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ describe('ipc module', function () {
|
||||||
var remoteFunctions = remote.require(path.join(fixtures, 'module', 'function.js'))
|
var remoteFunctions = remote.require(path.join(fixtures, 'module', 'function.js'))
|
||||||
assert.equal(remoteFunctions.aFunction(), 1127)
|
assert.equal(remoteFunctions.aFunction(), 1127)
|
||||||
|
|
||||||
remoteFunctions.aFunction = function () { return 1234; }
|
remoteFunctions.aFunction = function () { return 1234 }
|
||||||
assert.equal(remoteFunctions.aFunction(), 1234)
|
assert.equal(remoteFunctions.aFunction(), 1234)
|
||||||
|
|
||||||
assert.equal(delete remoteFunctions.aFunction, true)
|
assert.equal(delete remoteFunctions.aFunction, true)
|
||||||
|
@ -106,7 +106,7 @@ describe('ipc module', function () {
|
||||||
it('can return same object with different getters', function () {
|
it('can return same object with different getters', function () {
|
||||||
var contents1 = remote.getCurrentWindow().webContents
|
var contents1 = remote.getCurrentWindow().webContents
|
||||||
var contents2 = remote.getCurrentWebContents()
|
var contents2 = remote.getCurrentWebContents()
|
||||||
assert(contents1 == contents2)
|
assert(contents1 === contents2)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -391,7 +391,7 @@ describe('chromium feature', function () {
|
||||||
done('user agent is empty')
|
done('user agent is empty')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
var socket = new WebSocket(`ws://127.0.0.1: ${port}`)
|
var socket = new WebSocket(`ws://127.0.0.1:${port}`)
|
||||||
assert(socket)
|
assert(socket)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue