diff --git a/javascript/node/selenium-webdriver/lib/test/build.js b/javascript/node/selenium-webdriver/lib/test/build.js index 0b1c4d1a53728..f3a83f0028946 100644 --- a/javascript/node/selenium-webdriver/lib/test/build.js +++ b/javascript/node/selenium-webdriver/lib/test/build.js @@ -20,7 +20,6 @@ const fs = require('fs') const path = require('path') const { spawn } = require('child_process') - const PROJECT_ROOT = path.normalize(path.join(__dirname, '../../../../..')) const WORKSPACE_FILE = path.join(PROJECT_ROOT, 'WORKSPACE') @@ -38,14 +37,14 @@ function checkIsDevMode() { * Targets that have been previously built. * @type {!Object} */ -var builtTargets = {} +let builtTargets = {} /** * @param {!Array.} targets The targets to build. * @throws {Error} If not running in dev mode. * @constructor */ -var Build = function (targets) { +const Build = function (targets) { checkIsDevMode() this.targets_ = targets } @@ -70,7 +69,7 @@ Build.prototype.onlyOnce = function () { * @throws {Error} If no targets were specified. */ Build.prototype.go = function () { - var targets = this.targets_ + let targets = this.targets_ if (!targets.length) { throw Error('No targets specified') } @@ -88,7 +87,7 @@ Build.prototype.go = function () { console.log('\nBuilding', targets.join(' '), '...') - var cmd, + let cmd, args = targets if (process.platform === 'win32') { cmd = 'cmd.exe' @@ -110,7 +109,7 @@ Build.prototype.go = function () { return resolve() } - var msg = 'Unable to build artifacts' + let msg = 'Unable to build artifacts' if (code) { // May be null. msg += '; code=' + code @@ -135,7 +134,7 @@ exports.isDevMode = isDevMode * @throws {Error} If not running in dev mode. */ exports.of = function (var_args) { // eslint-disable-line - var targets = Array.prototype.slice.call(arguments, 0) + let targets = Array.prototype.slice.call(arguments, 0) return new Build(targets) } diff --git a/javascript/node/selenium-webdriver/lib/test/httpserver.js b/javascript/node/selenium-webdriver/lib/test/httpserver.js index a5a7bbe3e0138..46923c06bed62 100644 --- a/javascript/node/selenium-webdriver/lib/test/httpserver.js +++ b/javascript/node/selenium-webdriver/lib/test/httpserver.js @@ -17,11 +17,11 @@ 'use strict' -var assert = require('assert'), +const assert = require('assert'), http = require('http'), url = require('url') -var net = require('../../net'), +const net = require('../../net'), portprober = require('../../net/portprober'), promise = require('../..').promise @@ -32,8 +32,8 @@ var net = require('../../net'), * The request handler for the server. * @constructor */ -var Server = function (requestHandler) { - var server = http.createServer(function (req, res) { +let Server = function (requestHandler) { + let server = http.createServer(function (req, res) { requestHandler(req, res) }) @@ -42,7 +42,7 @@ var Server = function (requestHandler) { }) /** @typedef {{port: number, address: string, family: string}} */ - var Host // eslint-disable-line + let Host // eslint-disable-line /** * Starts the server on the given port. If no port, or 0, is provided, @@ -56,7 +56,7 @@ var Server = function (requestHandler) { typeof opt_port !== 'function', 'start invoked with function, not port (mocha callback)?' ) - var port = opt_port || portprober.findFreePort('localhost') + const port = opt_port || portprober.findFreePort('localhost') return Promise.resolve(port) .then((port) => { return promise.checkedNodeCall( @@ -82,7 +82,7 @@ var Server = function (requestHandler) { * @throws {Error} If the server is not running. */ this.address = function () { - var addr = server.address() + const addr = server.address() if (!addr) { throw Error('There server is not running!') } @@ -104,8 +104,8 @@ var Server = function (requestHandler) { * @throws {Error} If the server is not running. */ this.url = function (opt_pathname) { - var addr = this.address() - var pathname = opt_pathname || '' + const addr = this.address() + const pathname = opt_pathname || '' return url.format({ protocol: 'http', hostname: net.getLoopbackAddress(), diff --git a/javascript/node/selenium-webdriver/lib/test/resources.js b/javascript/node/selenium-webdriver/lib/test/resources.js index 4d7f32ab043c2..553aee00261af 100644 --- a/javascript/node/selenium-webdriver/lib/test/resources.js +++ b/javascript/node/selenium-webdriver/lib/test/resources.js @@ -30,7 +30,7 @@ const { projectRoot } = require('./build') * @throws {Error} If the file does not exist. */ exports.locate = function (filePath) { - var fullPath = path.normalize(path.join(projectRoot(), filePath)) + const fullPath = path.normalize(path.join(projectRoot(), filePath)) if (!fs.existsSync(fullPath)) { throw Error('File does not exist: ' + filePath) }