mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-27 19:25:13 +02:00
Fix all JSHint complaints in Node.js code.
This commit is contained in:
@@ -51,7 +51,7 @@ devutil.ensureUnusedPort = function(adb, serial, port) {
|
||||
conn.end()
|
||||
throw new Error(util.format('Port "%d" should be unused', port))
|
||||
})
|
||||
.catch(closedError, function(err) {
|
||||
.catch(closedError, function() {
|
||||
return Promise.resolve(port)
|
||||
})
|
||||
}
|
||||
@@ -62,7 +62,7 @@ devutil.waitForPort = function(adb, serial, port) {
|
||||
conn.port = port
|
||||
return conn
|
||||
})
|
||||
.catch(closedError, function(err) {
|
||||
.catch(closedError, function() {
|
||||
return Promise.delay(100)
|
||||
.then(function() {
|
||||
return devutil.waitForPort(adb, serial, port)
|
||||
@@ -93,7 +93,7 @@ devutil.waitForPortToFree = function(adb, serial, port) {
|
||||
conn.end()
|
||||
})
|
||||
})
|
||||
.catch(closedError, function(err) {
|
||||
.catch(closedError, function() {
|
||||
return port
|
||||
})
|
||||
}
|
||||
@@ -105,7 +105,7 @@ devutil.listPidsByComm = function(adb, serial, comm, bin) {
|
||||
|
||||
return adb.shell(serial, ['ps', comm])
|
||||
.then(function(out) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
return new Promise(function(resolve) {
|
||||
var header = false
|
||||
, pids = []
|
||||
out.pipe(split())
|
||||
@@ -147,7 +147,7 @@ devutil.killProcsByComm = function(adb, serial, comm, bin, mode) {
|
||||
}
|
||||
return adb.shell(serial, ['kill', mode || -15].concat(pids))
|
||||
.then(function(out) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
return new Promise(function(resolve) {
|
||||
out.on('end', resolve)
|
||||
})
|
||||
})
|
||||
@@ -165,8 +165,8 @@ devutil.makeIdentity = function(serial, properties) {
|
||||
var model = properties['ro.product.model']
|
||||
, brand = properties['ro.product.brand']
|
||||
, manufacturer = properties['ro.product.manufacturer']
|
||||
, operator = properties['gsm.sim.operator.alpha']
|
||||
|| properties['gsm.operator.alpha']
|
||||
, operator = properties['gsm.sim.operator.alpha'] ||
|
||||
properties['gsm.operator.alpha']
|
||||
, version = properties['ro.build.version.release']
|
||||
, sdk = properties['ro.build.version.sdk']
|
||||
, abi = properties['ro.product.cpu.abi']
|
||||
|
||||
@@ -1,9 +1,41 @@
|
||||
var util = require('util')
|
||||
var events = require('events')
|
||||
|
||||
var colors = require('colors')
|
||||
// Enable "string".color
|
||||
require('colors')
|
||||
|
||||
function Log(tag, stream) {
|
||||
var Logger = new events.EventEmitter()
|
||||
|
||||
Logger.Level = {
|
||||
DEBUG: 1
|
||||
, VERBOSE: 2
|
||||
, INFO: 3
|
||||
, WARNING: 4
|
||||
, ERROR: 5
|
||||
, FATAL: 6
|
||||
}
|
||||
|
||||
Logger.LevelLabel = {
|
||||
1: 'DBG'
|
||||
, 2: 'VRB'
|
||||
, 3: 'INF'
|
||||
, 4: 'WRN'
|
||||
, 5: 'ERR'
|
||||
, 6: 'FTL'
|
||||
}
|
||||
|
||||
Logger.globalIdentifier = '*'
|
||||
|
||||
Logger.createLogger = function(tag) {
|
||||
return new Log(tag)
|
||||
}
|
||||
|
||||
Logger.setGlobalIdentifier = function(identifier) {
|
||||
Logger.globalIdentifier = identifier
|
||||
return Logger
|
||||
}
|
||||
|
||||
function Log(tag) {
|
||||
this.tag = tag
|
||||
this.names = {
|
||||
1: 'DBG'
|
||||
@@ -95,35 +127,4 @@ Log.prototype._write = function(entry) {
|
||||
Logger.emit('entry', entry)
|
||||
}
|
||||
|
||||
var Logger = new events.EventEmitter()
|
||||
|
||||
Logger.Level = {
|
||||
DEBUG: 1
|
||||
, VERBOSE: 2
|
||||
, INFO: 3
|
||||
, WARNING: 4
|
||||
, ERROR: 5
|
||||
, FATAL: 6
|
||||
}
|
||||
|
||||
Logger.LevelLabel = {
|
||||
1: 'DBG'
|
||||
, 2: 'VRB'
|
||||
, 3: 'INF'
|
||||
, 4: 'WRN'
|
||||
, 5: 'ERR'
|
||||
, 6: 'FTL'
|
||||
}
|
||||
|
||||
Logger.globalIdentifier = '*'
|
||||
|
||||
Logger.createLogger = function(tag) {
|
||||
return new Log(tag)
|
||||
}
|
||||
|
||||
Logger.setGlobalIdentifier = function(identifier) {
|
||||
Logger.globalIdentifier = identifier
|
||||
return Logger
|
||||
}
|
||||
|
||||
exports = module.exports = Logger
|
||||
|
||||
@@ -54,10 +54,10 @@ module.exports.fork = function() {
|
||||
process.removeListener('SIGINT', sigintListener)
|
||||
process.removeListener('SIGTERM', sigtermListener)
|
||||
})
|
||||
.catch(Promise.CancellationError, function(err) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
.catch(Promise.CancellationError, function() {
|
||||
return new Promise(function(resolve) {
|
||||
proc.on('exit', function() {
|
||||
resolver.resolve()
|
||||
resolve()
|
||||
})
|
||||
proc.kill()
|
||||
})
|
||||
|
||||
@@ -27,7 +27,7 @@ module.exports.readAll = function(stream) {
|
||||
|
||||
function readableListener() {
|
||||
var chunk;
|
||||
while (chunk = stream.read()) {
|
||||
while ((chunk = stream.read())) {
|
||||
collected = Buffer.concat([collected, chunk])
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user