dance around error checking with this one weird trick
This commit is contained in:
Родитель
5e4696f4a7
Коммит
c5f70c8d99
|
@ -80,24 +80,28 @@ describe('debugger module', function () {
|
|||
try {
|
||||
w.webContents.debugger.attach()
|
||||
} 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) {
|
||||
assert(!res.wasThrown)
|
||||
assert.equal(res.result.value, 6)
|
||||
w.webContents.debugger.detach()
|
||||
done()
|
||||
}
|
||||
/* eslint-enable */
|
||||
const params = {
|
||||
'expression': '4+2',
|
||||
'expression': '4+2'
|
||||
}
|
||||
w.webContents.debugger.sendCommand('Runtime.evaluate', params, callback)
|
||||
})
|
||||
|
||||
it('fires message event', function (done) {
|
||||
var url = process.platform != 'win32' ?
|
||||
'file://' + path.join(fixtures, 'pages', 'a.html') :
|
||||
'file:///' + path.join(fixtures, 'pages', 'a.html').replace(/\\/g, '/')
|
||||
var url = process.platform !== 'win32'
|
||||
? 'file://' + path.join(fixtures, 'pages', 'a.html')
|
||||
: 'file:///' + path.join(fixtures, 'pages', 'a.html').replace(/\\/g, '/')
|
||||
w.webContents.loadURL(url)
|
||||
try {
|
||||
w.webContents.debugger.attach()
|
||||
|
@ -105,7 +109,7 @@ describe('debugger module', function () {
|
|||
done('unexpected error : ' + err)
|
||||
}
|
||||
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.url, url)
|
||||
assert.equal(params.message.text, 'a')
|
||||
|
|
|
@ -60,7 +60,7 @@ describe('ipc module', function () {
|
|||
|
||||
it('can construct an object from its member', function () {
|
||||
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')
|
||||
})
|
||||
|
||||
|
@ -68,7 +68,7 @@ describe('ipc module', function () {
|
|||
var remoteFunctions = remote.require(path.join(fixtures, 'module', 'function.js'))
|
||||
assert.equal(remoteFunctions.aFunction(), 1127)
|
||||
|
||||
remoteFunctions.aFunction = function () { return 1234; }
|
||||
remoteFunctions.aFunction = function () { return 1234 }
|
||||
assert.equal(remoteFunctions.aFunction(), 1234)
|
||||
|
||||
assert.equal(delete remoteFunctions.aFunction, true)
|
||||
|
@ -106,7 +106,7 @@ describe('ipc module', function () {
|
|||
it('can return same object with different getters', function () {
|
||||
var contents1 = remote.getCurrentWindow().webContents
|
||||
var contents2 = remote.getCurrentWebContents()
|
||||
assert(contents1 == contents2)
|
||||
assert(contents1 === contents2)
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -391,7 +391,7 @@ describe('chromium feature', function () {
|
|||
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)
|
||||
})
|
||||
})
|
||||
|
|
Загрузка…
Ссылка в новой задаче