mostly more globals
This commit is contained in:
parent
c4b6cf4a8e
commit
9db733a4ff
6 changed files with 38 additions and 30 deletions
|
@ -1,3 +1,5 @@
|
|||
/* globals fetch */
|
||||
|
||||
const assert = require('assert')
|
||||
const path = require('path')
|
||||
const webFrame = require('electron').webFrame
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* globals xit */
|
||||
|
||||
const assert = require('assert')
|
||||
const child_process = require('child_process')
|
||||
const fs = require('fs')
|
||||
|
@ -560,7 +562,9 @@ describe('asar package', function () {
|
|||
if (process.platform !== 'darwin') {
|
||||
return
|
||||
}
|
||||
ref2 = require('child_process'), execFile = ref2.execFile, execFileSync = ref2.execFileSync
|
||||
ref2 = require('child_process')
|
||||
execFile = ref2.execFile
|
||||
execFileSync = ref2.execFileSync
|
||||
echo = path.join(fixtures, 'asar', 'echo.asar', 'echo')
|
||||
|
||||
it('executes binaries', function (done) {
|
||||
|
@ -609,18 +613,18 @@ describe('asar package', function () {
|
|||
it('disables asar support in sync API', function () {
|
||||
var file = path.join(fixtures, 'asar', 'a.asar', 'file1')
|
||||
var dir = path.join(fixtures, 'asar', 'a.asar', 'dir1')
|
||||
assert.throws((function () {
|
||||
assert.throws(function () {
|
||||
fs.readFileSync(file)
|
||||
}), new RegExp(errorName))
|
||||
assert.throws((function () {
|
||||
}, new RegExp(errorName))
|
||||
assert.throws(function () {
|
||||
fs.lstatSync(file)
|
||||
}), new RegExp(errorName))
|
||||
assert.throws((function () {
|
||||
}, new RegExp(errorName))
|
||||
assert.throws(function () {
|
||||
fs.realpathSync(file)
|
||||
}), new RegExp(errorName))
|
||||
assert.throws((function () {
|
||||
}, new RegExp(errorName))
|
||||
assert.throws(function () {
|
||||
fs.readdirSync(dir)
|
||||
}), new RegExp(errorName))
|
||||
}, new RegExp(errorName))
|
||||
})
|
||||
|
||||
it('disables asar support in async API', function (done) {
|
||||
|
@ -647,9 +651,9 @@ describe('asar package', function () {
|
|||
var content1 = fs.readFileSync(asar)
|
||||
var content2 = originalFs.readFileSync(asar)
|
||||
assert.equal(content1.compare(content2), 0)
|
||||
assert.throws((function () {
|
||||
assert.throws(function () {
|
||||
fs.readdirSync(asar)
|
||||
}), /ENOTDIR/)
|
||||
}, /ENOTDIR/)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -785,9 +789,9 @@ describe('asar package', function () {
|
|||
|
||||
it('throws error when calling inside asar archive', function () {
|
||||
var p = path.join(fixtures, 'asar', 'a.asar', 'not-exist')
|
||||
assert.throws((function () {
|
||||
assert.throws(function () {
|
||||
mkdirp.sync(p)
|
||||
}), new RegExp('ENOTDIR'))
|
||||
}, new RegExp('ENOTDIR'))
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* globals xdescribe, Worker, SharedWorker, WebSocket, HTMLElement */
|
||||
|
||||
const assert = require('assert')
|
||||
const http = require('http')
|
||||
const path = require('path')
|
||||
|
@ -295,15 +297,15 @@ describe('chromium feature', function () {
|
|||
describe('creating a Uint8Array under browser side', function () {
|
||||
it('does not crash', function () {
|
||||
var RUint8Array = remote.getGlobal('Uint8Array')
|
||||
new RUint8Array
|
||||
var arr = new RUint8Array()
|
||||
assert(arr)
|
||||
})
|
||||
})
|
||||
|
||||
describe('webgl', function () {
|
||||
it('can be get as context in canvas', function () {
|
||||
if (process.platform === 'linux') {
|
||||
return
|
||||
}
|
||||
if (process.platform === 'linux') return
|
||||
|
||||
var webgl = document.createElement('canvas').getContext('webgl')
|
||||
assert.notEqual(webgl, null)
|
||||
})
|
||||
|
@ -387,7 +389,8 @@ describe('chromium feature', function () {
|
|||
done('user agent is empty')
|
||||
}
|
||||
})
|
||||
new WebSocket('ws://127.0.0.1:' + port)
|
||||
var socket = new WebSocket(`ws://127.0.0.1: ${port}`)
|
||||
assert(socket)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
4
spec/fixtures/module/class.js
vendored
4
spec/fixtures/module/class.js
vendored
|
@ -24,6 +24,6 @@ class DerivedClass extends BaseClass {
|
|||
}
|
||||
|
||||
module.exports = {
|
||||
base: new BaseClass,
|
||||
derived: new DerivedClass,
|
||||
base: new BaseClass(),
|
||||
derived: new DerivedClass()
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ app.on('ready', function () {
|
|||
setImmediate(function () {
|
||||
try {
|
||||
item.getURL()
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
window.webContents.send('download-error', url, filename, err.message)
|
||||
}
|
||||
})
|
||||
|
@ -132,8 +132,7 @@ app.on('ready', function () {
|
|||
item.getContentDisposition(),
|
||||
item.getFilename())
|
||||
})
|
||||
if (need_cancel)
|
||||
item.cancel()
|
||||
if (need_cancel) item.cancel()
|
||||
}
|
||||
})
|
||||
event.returnValue = 'done'
|
||||
|
|
|
@ -45,7 +45,7 @@ function getIndexJsInServer (callback) {
|
|||
request(TARGET_URL, function (e, res, body) {
|
||||
if (e) {
|
||||
callback(e)
|
||||
} else if (res.statusCode != 200) {
|
||||
} else if (res.statusCode !== 200) {
|
||||
callback(new Error('Server returned ' + res.statusCode))
|
||||
} else {
|
||||
callback(null, JSON.parse(body))
|
||||
|
@ -54,9 +54,9 @@ function getIndexJsInServer (callback) {
|
|||
}
|
||||
|
||||
function findObjectByVersion (all, version) {
|
||||
for (var i in all)
|
||||
if (all[i].version == version)
|
||||
return i
|
||||
for (var i in all) {
|
||||
if (all[i].version === version) return i
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
|
@ -69,11 +69,11 @@ app.on('ready', function () {
|
|||
|
||||
var current = getInfoForCurrentVersion()
|
||||
var found = findObjectByVersion(all, current.version)
|
||||
if (found == -1)
|
||||
if (found === -1) {
|
||||
all.unshift(current)
|
||||
else
|
||||
} else {
|
||||
all[found] = current
|
||||
|
||||
}
|
||||
fs.writeFileSync(process.argv[2], JSON.stringify(all))
|
||||
process.exit(0)
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue