From 078ecb6678fd6d939078859e28d08ab1a015cf00 Mon Sep 17 00:00:00 2001 From: Priyansh Garg Date: Tue, 22 Aug 2023 16:14:53 +0530 Subject: [PATCH] Fix space-infix-ops rule. --- lib/api/assertions/_assertionInstance.js | 2 +- lib/api/expect/assertions/_baseAssertion.js | 14 ++++---- lib/api/expect/assertions/element/type.js | 2 +- lib/core/asynctree.js | 2 +- lib/element/command.js | 4 +-- lib/http/formatter.js | 14 ++++---- lib/http/request.js | 2 +- lib/reporter/index.js | 6 ++-- lib/reporter/summary.js | 2 +- lib/runner/concurrency/child-process.js | 4 +-- lib/runner/concurrency/index.js | 2 +- lib/runner/test-runners/mocha.js | 4 +-- lib/transport/selenium-webdriver/cdp.js | 2 +- lib/utils/logger/index.js | 2 +- .../commands/workingCommandsClass.js | 2 +- test/lib/command-mocks.js | 4 +-- test/lib/nightwatch.js | 4 +-- test/lib/nocks.js | 8 ++--- test/src/analytics/testAnalytics.js | 2 +- test/src/api/commands/client/testWaitUntil.js | 16 ++++----- .../element/testWaitForElementPresent.js | 2 +- test/src/cli/testParallelExecution.js | 34 +++++++++---------- test/src/runner/cli/testCliRunnerParallel.js | 2 +- .../cucumber-integration/testCliArgs.js | 16 ++++----- 24 files changed, 76 insertions(+), 76 deletions(-) diff --git a/lib/api/assertions/_assertionInstance.js b/lib/api/assertions/_assertionInstance.js index 273671ee0c..7bca65cbab 100644 --- a/lib/api/assertions/_assertionInstance.js +++ b/lib/api/assertions/_assertionInstance.js @@ -21,7 +21,7 @@ class AssertionInstance { } static init({nightwatchInstance, args, fileName, options}) { - if (Utils.isFunction(args[args.length-1])) { + if (Utils.isFunction(args[args.length - 1])) { this.__doneCallback = args.pop(); } else { this.__doneCallback = function(result) { diff --git a/lib/api/expect/assertions/_baseAssertion.js b/lib/api/expect/assertions/_baseAssertion.js index 756b1dd7cf..bc492b0926 100644 --- a/lib/api/expect/assertions/_baseAssertion.js +++ b/lib/api/expect/assertions/_baseAssertion.js @@ -147,7 +147,7 @@ class BaseAssertion { init() { const {waitForConditionTimeout, waitForConditionPollInterval, abortOnAssertionFailure} = this.client.api.globals; - let assertions = this.flag('assertions') || 0; + const assertions = this.flag('assertions') || 0; this.flag('assertions', assertions + 1); this.promise = this.flag('promise'); @@ -340,7 +340,7 @@ class BaseAssertion { } getResult(value, fn) { - let result = fn.call(this); + const result = fn.call(this); this.setNegate(); return this.negate ? !result : result; @@ -357,7 +357,7 @@ class BaseAssertion { } getElapsedTime() { - let timeNow = new Date().getTime(); + const timeNow = new Date().getTime(); return timeNow - this.emitter.startTime; } @@ -467,8 +467,8 @@ class BaseAssertion { } '@matchesFlag'(re) { - let adverb = this.hasFlag('that') || this.hasFlag('which'); - let verb = adverb ? 'matches' : 'match'; + const adverb = this.hasFlag('that') || this.hasFlag('which'); + const verb = adverb ? 'matches' : 'match'; this.conditionFlag(re, function() { return re.test(this.resultValue); @@ -483,7 +483,7 @@ class BaseAssertion { conditionFlag(value, conditionFn, arrverb) { this.passed = this.getResult(value, conditionFn); - let verb = this.negate ? arrverb[0]: arrverb[1]; + let verb = this.negate ? arrverb[0] : arrverb[1]; this.expected = `${verb} '${value}'`; this.actual = this.resultValue; @@ -491,7 +491,7 @@ class BaseAssertion { return; } - let needsSpace = this.messageParts.length === 0 ? true : this.messageParts[this.messageParts.length-1].slice(-1) !== ' '; + const needsSpace = this.messageParts.length === 0 ? true : this.messageParts[this.messageParts.length - 1].slice(-1) !== ' '; if (needsSpace) { verb = ' ' + verb; } diff --git a/lib/api/expect/assertions/element/type.js b/lib/api/expect/assertions/element/type.js index f7ec379fab..b02d4f02f2 100644 --- a/lib/api/expect/assertions/element/type.js +++ b/lib/api/expect/assertions/element/type.js @@ -34,7 +34,7 @@ class TypeAssertion extends BaseAssertion { this.article = ['a', 'e', 'i', 'o'].indexOf(type.toString().substring(0, 1)) > -1 ? 'an' : 'a'; this.hasCustomMessage = typeof msg != 'undefined'; this.flag('typeFlag', true); - this.message = msg || 'Expected element %s to ' + (this.negate ? 'not be' : 'be') + ' ' + this.article +' ' + type; + this.message = msg || 'Expected element %s to ' + (this.negate ? 'not be' : 'be') + ' ' + this.article + ' ' + type; this.start(); } diff --git a/lib/core/asynctree.js b/lib/core/asynctree.js index 317310c494..72152e56b9 100644 --- a/lib/core/asynctree.js +++ b/lib/core/asynctree.js @@ -92,7 +92,7 @@ class AsyncTree extends EventEmitter{ } shouldRejectNodePromise(err, node = this.currentNode) { - if ((err.isExpect|| node.namespace === 'assert') && this.currentNode.isES6Async) { + if ((err.isExpect || node.namespace === 'assert') && this.currentNode.isES6Async) { return true; } diff --git a/lib/element/command.js b/lib/element/command.js index 8fda88135b..5a71187be5 100644 --- a/lib/element/command.js +++ b/lib/element/command.js @@ -274,7 +274,7 @@ class ElementCommand extends EventEmitter { } if (passedArgs < expectedArgs - 1 || passedArgs > expectedArgs) { - const error = new Error(`${this.commandName} method expects ${(expectedArgs - 1)} `+ + const error = new Error(`${this.commandName} method expects ${(expectedArgs - 1)} ` + `(or ${expectedArgs} if using implicit "css selector" strategy) arguments - ${passedArgs} given.`); error.rejectPromise = rejectPromise; @@ -339,7 +339,7 @@ class ElementCommand extends EventEmitter { this.__retryOnFailure = retryAction; } - let {WebdriverElementId} = this.selector; + const {WebdriverElementId} = this.selector; if (WebdriverElementId) { this.WebdriverElementId = WebdriverElementId; } diff --git a/lib/http/formatter.js b/lib/http/formatter.js index fe720e6efd..3d9013d6f2 100644 --- a/lib/http/formatter.js +++ b/lib/http/formatter.js @@ -12,10 +12,10 @@ class ResponseFormatter { */ static jsonStringify(s) { try { - let json = JSON.stringify(s); + const json = JSON.stringify(s); if (json) { return json.replace(jsonRegex, function jsonRegexReplace(c) { - return '\\u'+('0000'+c.charCodeAt(0).toString(16)).slice(-4); + return '\\u' + ('0000' + c.charCodeAt(0).toString(16)).slice(-4); }); } @@ -29,9 +29,9 @@ class ResponseFormatter { } static stripUnknownChars(str) { - let x = []; + const x = []; let i = 0; - let length = str.length; + const length = str.length; for (i; i < length; i++) { if (str.charCodeAt(i)) { @@ -43,9 +43,9 @@ class ResponseFormatter { } static formatHostname(hostname, port, useSSL) { - let isLocalHost = ['127.0.0.1', 'localhost'].indexOf(hostname) > -1; - let protocol = useSSL ? 'https://' : 'http://'; - let isPortDefault = [80, 443].indexOf(port) > -1; + const isLocalHost = ['127.0.0.1', 'localhost'].indexOf(hostname) > -1; + const protocol = useSSL ? 'https://' : 'http://'; + const isPortDefault = [80, 443].indexOf(port) > -1; if (isLocalHost) { return ''; diff --git a/lib/http/request.js b/lib/http/request.js index c03d7f14e8..ce14072ecc 100644 --- a/lib/http/request.js +++ b/lib/http/request.js @@ -218,7 +218,7 @@ class HttpRequest extends EventEmitter { createHttpRequest() { try { - const req = (this.use_ssl ? https: http).request(this.reqOptions, response => { + const req = (this.use_ssl ? https : http).request(this.reqOptions, response => { this.httpResponse = new HttpResponse(response, this); this.httpResponse.on('complete', this.onRequestComplete.bind(this)); this.proxyEvents(this.httpResponse, ['response', 'error', 'success']); diff --git a/lib/reporter/index.js b/lib/reporter/index.js index e004785061..35d49f54f8 100644 --- a/lib/reporter/index.js +++ b/lib/reporter/index.js @@ -160,11 +160,11 @@ class Reporter extends SimplifiedReporter { logTestCase(testName) { if (this.settings.live_output || !this.settings.parallel_mode) { // eslint-disable-next-line no-console - console.log(`${(!this.settings.silent?'\n\n':'')}\n Running ${colors.green(testName)}${colors.stack_trace(':')}`); + console.log(`${(!this.settings.silent ? '\n\n' : '')}\n Running ${colors.green(testName)}${colors.stack_trace(':')}`); const {columns = 100} = process.stdout; // eslint-disable-next-line no-console - console.log(colors.stack_trace(new Array(Math.max(100, Math.floor(columns/2))).join('─'))); + console.log(colors.stack_trace(new Array(Math.max(100, Math.floor(columns / 2))).join('─'))); //} } else { // eslint-disable-next-line no-console @@ -327,7 +327,7 @@ class Reporter extends SimplifiedReporter { printSimplifiedTestResult(ok, elapsedTime, isWorker) { const {currentTest} = this; - const result = [colors[ok ? 'green': 'red'](Utils.symbols[ok ? 'ok' : 'fail'])]; + const result = [colors[ok ? 'green' : 'red'](Utils.symbols[ok ? 'ok' : 'fail'])]; if (!this.unitTestsMode) { if (isWorker) { result.push(colors.bgBlack.white.bold(this.settings.testEnv)); diff --git a/lib/reporter/summary.js b/lib/reporter/summary.js index 9d4e5170c4..fdf022f35a 100644 --- a/lib/reporter/summary.js +++ b/lib/reporter/summary.js @@ -26,7 +26,7 @@ module.exports = class Summary { */ static getFailedSuiteContent({testSuite, testSuiteName, index = 0, startSessionEnabled = true}) { const testcases = Object.keys(testSuite.completed); - const initial = [colors.red(` ${Utils.symbols.fail} ${index+1}) ${testSuiteName}`)]; + const initial = [colors.red(` ${Utils.symbols.fail} ${index + 1}) ${testSuiteName}`)]; return testcases.reduce((prev, name) => { const testcase = testSuite.completed[name]; diff --git a/lib/runner/concurrency/child-process.js b/lib/runner/concurrency/child-process.js index 4fcf7539ad..1eddf4edfa 100644 --- a/lib/runner/concurrency/child-process.js +++ b/lib/runner/concurrency/child-process.js @@ -81,7 +81,7 @@ class ChildProcess extends EventEmitter { writeToStdout(data) { data = data.toString().trim(); - const color_pair = this.availColors[this.index%4]; + const color_pair = this.availColors[this.index % 4]; let output = ''; if (ChildProcess.prevIndex !== this.index) { @@ -148,7 +148,7 @@ class ChildProcess extends EventEmitter { })); } - const color_pair = this.availColors[this.index%4]; + const color_pair = this.availColors[this.index % 4]; this.printLog(' Running: ' + Logger.colors[color_pair[0]][color_pair[1]](` ${this.env_itemKey} `)); diff --git a/lib/runner/concurrency/index.js b/lib/runner/concurrency/index.js index 1caa4580df..fa64d842c7 100644 --- a/lib/runner/concurrency/index.js +++ b/lib/runner/concurrency/index.js @@ -255,7 +255,7 @@ class Concurrency extends EventEmitter { return this.runChildProcess(childProcess, outputLabel, availColors, 'workers') .then(_ => { - remaining -=1; + remaining -= 1; if (remaining > 0) { next(); diff --git a/lib/runner/test-runners/mocha.js b/lib/runner/test-runners/mocha.js index d601b02e4a..3af11a28be 100644 --- a/lib/runner/test-runners/mocha.js +++ b/lib/runner/test-runners/mocha.js @@ -118,7 +118,7 @@ class MochaRunner { if (this.isTestWorker()) { const filePath = this.argv.test; - const reportFilename = filePath.substring(filePath.lastIndexOf('/')+1).split('.')[0]; + const reportFilename = filePath.substring(filePath.lastIndexOf('/') + 1).split('.')[0]; this.mochaOpts.isWorker = true; if (argv.reporter.includes('mocha-junit-reporter')) { @@ -194,7 +194,7 @@ class MochaRunner { const client = mochaSuite && mochaSuite.client; if (client && client.sessionId) { - let request = client.transport.createHttpRequest({ + const request = client.transport.createHttpRequest({ path: `/session/${client.sessionId}` }); diff --git a/lib/transport/selenium-webdriver/cdp.js b/lib/transport/selenium-webdriver/cdp.js index d48a8a42e9..06bf9c20a9 100644 --- a/lib/transport/selenium-webdriver/cdp.js +++ b/lib/transport/selenium-webdriver/cdp.js @@ -1,5 +1,5 @@ class Cdp { - async getConnection(driver, reset=false) { + async getConnection(driver, reset = false) { if (!reset && this._connection) { return this._connection; } diff --git a/lib/utils/logger/index.js b/lib/utils/logger/index.js index afd03c3fd8..455770520a 100644 --- a/lib/utils/logger/index.js +++ b/lib/utils/logger/index.js @@ -400,7 +400,7 @@ class Logger { if (errorObj.help) { content.push(this.colors.brown('\n Try fixing by :')); errorObj.help.forEach((step, index) => { - content.push(` ${this.colors.blue(index+1)}. ${step}`); + content.push(` ${this.colors.blue(index + 1)}. ${step}`); }); } diff --git a/test/extra/pageobjects/commands/workingCommandsClass.js b/test/extra/pageobjects/commands/workingCommandsClass.js index a0074cc355..cd12a7e53b 100644 --- a/test/extra/pageobjects/commands/workingCommandsClass.js +++ b/test/extra/pageobjects/commands/workingCommandsClass.js @@ -5,7 +5,7 @@ module.exports = class RealCommands { selector, suppressNotFoundErrors: true }, function(result) { - return callback(result ? result.value: []); + return callback(result ? result.value : []); }); } diff --git a/test/lib/command-mocks.js b/test/lib/command-mocks.js index 8c08da65b3..4f79dcc93a 100644 --- a/test/lib/command-mocks.js +++ b/test/lib/command-mocks.js @@ -269,7 +269,7 @@ module.exports = { }, true); }, - w3cSelected(elementId ='5cc459b8-36a8-3042-8b4a-258883ea642b', value = true) { + w3cSelected(elementId = '5cc459b8-36a8-3042-8b4a-258883ea642b', value = true) { MockServer.addMock({ url: `/session/13521-10219-202/element/${elementId}/selected`, method: 'GET', @@ -279,7 +279,7 @@ module.exports = { }, true); }, - w3cEnabled(elementId ='5cc459b8-36a8-3042-8b4a-258883ea642b', value = true) { + w3cEnabled(elementId = '5cc459b8-36a8-3042-8b4a-258883ea642b', value = true) { MockServer.addMock({ url: `/session/13521-10219-202/element/${elementId}/enabled`, method: 'GET', diff --git a/test/lib/nightwatch.js b/test/lib/nightwatch.js index db72dfc1a7..85d8e218ee 100644 --- a/test/lib/nightwatch.js +++ b/test/lib/nightwatch.js @@ -46,7 +46,7 @@ module.exports = new function () { } this.createClient = function(options = {}, reporter = null, argv = {}) { - let opts = { + const opts = { selenium: { port: 10195, host: 'localhost', @@ -118,7 +118,7 @@ module.exports = new function () { }); }; - this.initW3CClient = function(opts = {}, argv={}) { + this.initW3CClient = function(opts = {}, argv = {}) { const settings = Object.assign({ selenium: { version2: false, diff --git a/test/lib/nocks.js b/test/lib/nocks.js index e40d4f5195..34820bf6e3 100644 --- a/test/lib/nocks.js +++ b/test/lib/nocks.js @@ -191,7 +191,7 @@ module.exports = { return this; }, - childElementsNotFound(selector='#badElement') { + childElementsNotFound(selector = '#badElement') { nock('http://localhost:10195') .post('/wd/hub/session/1352110219202/element/0/elements', {'using': 'css selector', 'value': selector}) .reply(200, { @@ -203,14 +203,14 @@ module.exports = { return this; }, - childElementsFound(selector='#weblogin') { + childElementsFound(selector = '#weblogin') { nock('http://localhost:10195') .post('/wd/hub/session/1352110219202/element/0/elements', {'using': 'css selector', 'value': selector}) .reply(200, { status: 0, state: 'success', value: [{'element-6066-11e4-a52e-4f735466cecf': '0'}] - }) + }); return this; }, @@ -589,7 +589,7 @@ module.exports = { .reply(200, { status: 0, state: 'success', - value : { + value: { domain: 'cookie-domain', name: name, value: value diff --git a/test/src/analytics/testAnalytics.js b/test/src/analytics/testAnalytics.js index 3b26f5c617..fa5d869f6f 100644 --- a/test/src/analytics/testAnalytics.js +++ b/test/src/analytics/testAnalytics.js @@ -173,7 +173,7 @@ describe('test analytics utility', function() { const analyticsNock = Nocks.analyticsCollector(analytics.__getGoogleAnalyticsPath()); const err = new Error('test'); - err.name ='UserGeneratedError'; + err.name = 'UserGeneratedError'; await analytics.collectErrorEvent(err); diff --git a/test/src/api/commands/client/testWaitUntil.js b/test/src/api/commands/client/testWaitUntil.js index d04108b2ad..f0873298a4 100644 --- a/test/src/api/commands/client/testWaitUntil.js +++ b/test/src/api/commands/client/testWaitUntil.js @@ -105,7 +105,7 @@ describe('.waitUntil()', function () { it('client.waitUntil() function failure with custom timeout', function (done) { let tries = 0; - let startTime = new Date().valueOf(); + const startTime = new Date().valueOf(); let timeDiff; const maxTimeout = 100; const client = this.client.api; @@ -123,7 +123,7 @@ describe('.waitUntil()', function () { this.client.start(err => { try { - assert.ok(timeDiff <= maxTimeout+100, `Expected lower than ${maxTimeout}, but got ${timeDiff}`); + assert.ok(timeDiff <= maxTimeout + 100, `Expected lower than ${maxTimeout}, but got ${timeDiff}`); assert.strictEqual(result.status, -1); assert.strictEqual(tries, 3); assert.ok(err instanceof Error); @@ -136,7 +136,7 @@ describe('.waitUntil()', function () { it('client.waitUntil() function failure with custom timeout, interval, message, and callback', function (done) { let tries = 0; - let startTime = new Date().valueOf(); + const startTime = new Date().valueOf(); let timeDiff; const maxTimeout = 100; const client = this.client.api; @@ -154,7 +154,7 @@ describe('.waitUntil()', function () { this.client.start(err => { try { - assert.ok(timeDiff <= maxTimeout+100, `Expected lower than ${maxTimeout}, but got ${timeDiff}`); + assert.ok(timeDiff <= maxTimeout + 100, `Expected lower than ${maxTimeout}, but got ${timeDiff}`); assert.strictEqual(result.status, -1); assert.ok(err instanceof Error); const messageParts = err.message.split('\n'); @@ -196,7 +196,7 @@ describe('.waitUntil()', function () { it('client.waitUntil() function failure with custom timeout and default interval', function (done) { let tries = 0; - let startTime = new Date().valueOf(); + const startTime = new Date().valueOf(); let timeDiff; const maxTimeout = 100; const client = this.client.api; @@ -215,7 +215,7 @@ describe('.waitUntil()', function () { this.client.start(err => { try { assert.ok(err instanceof Error); - assert.ok(timeDiff <= maxTimeout+100, `Expected lower than ${maxTimeout}, but got ${timeDiff}`); + assert.ok(timeDiff <= maxTimeout + 100, `Expected lower than ${maxTimeout}, but got ${timeDiff}`); assert.strictEqual(result.status, -1); assert.strictEqual(tries, 3); done(); @@ -255,7 +255,7 @@ describe('.waitUntil()', function () { it('client.waitUntil() function failure with custom waitForConditionPollInterval', function (done) { let tries = 0; - let startTime = new Date().valueOf(); + const startTime = new Date().valueOf(); let timeDiff; const maxTimeout = 100; const client = this.client.api; @@ -276,7 +276,7 @@ describe('.waitUntil()', function () { this.client.start(err => { try { assert.ok(err instanceof Error); - assert.ok(timeDiff <= maxTimeout+100, `Expected lower than ${maxTimeout}, but got ${timeDiff}`); + assert.ok(timeDiff <= maxTimeout + 100, `Expected lower than ${maxTimeout}, but got ${timeDiff}`); assert.strictEqual(result.status, -1); assert.ok(tries > 5); done(); diff --git a/test/src/api/commands/element/testWaitForElementPresent.js b/test/src/api/commands/element/testWaitForElementPresent.js index 0b5b031388..c1d80f88b1 100644 --- a/test/src/api/commands/element/testWaitForElementPresent.js +++ b/test/src/api/commands/element/testWaitForElementPresent.js @@ -55,7 +55,7 @@ describe('waitForElementPresent', function() { }); it('client.waitForElementPresent() failure with custom time message', function(done){ - this.client.api.globals.waitForConditionPollInterval=10; + this.client.api.globals.waitForConditionPollInterval = 10; this.client.api.waitForElementPresent('.weblogin', 15, function callback(result, instance){ assert.strictEqual(instance.message, 'Element .weblogin found in 15 milliseconds'); }, 'Element %s found in %d milliseconds'); diff --git a/test/src/cli/testParallelExecution.js b/test/src/cli/testParallelExecution.js index a4b899a093..7039476279 100644 --- a/test/src/cli/testParallelExecution.js +++ b/test/src/cli/testParallelExecution.js @@ -7,7 +7,7 @@ const Nightwatch = require('../../lib/nightwatch.js'); describe('test Parallel Execution', function() { const workerPoolArgv = []; - const taskArgv= []; + const taskArgv = []; const allArgs = []; const allOpts = []; @@ -88,9 +88,9 @@ describe('test Parallel Execution', function() { it('testParallelExecution - child-process', function() { const CliRunner = common.require('runner/cli/cli.js'); - let originalCwd = process.cwd(); + const originalCwd = process.cwd(); process.chdir(path.join(__dirname, '../../extra/')); - let runner = new CliRunner({ + const runner = new CliRunner({ config: './nightwatch.json', env: 'default,mixed', reporter: 'junit' @@ -167,7 +167,7 @@ describe('test Parallel Execution', function() { it('test parallel execution with workers defaults -- worker thread', function() { const CliRunner = common.require('runner/cli/cli.js'); - let runner = new CliRunner({ + const runner = new CliRunner({ reporter: 'junit', config: path.join(__dirname, '../../extra/parallelism.json') }); @@ -187,10 +187,10 @@ describe('test Parallel Execution', function() { }); it('testParallelExecutionSameEnv - child-process', function() { - let originalCwd = process.cwd(); + const originalCwd = process.cwd(); process.chdir(path.join(__dirname, '../../extra/')); const CliRunner = common.require('runner/cli/cli.js'); - let runner = new CliRunner({ + const runner = new CliRunner({ config: './nightwatch.json', reporter: 'junit', env: 'mixed,mixed' @@ -211,11 +211,11 @@ describe('test Parallel Execution', function() { }); it('testParallelExecutionSameEnv - worker threads', function() { - let originalCwd = process.cwd(); + const originalCwd = process.cwd(); process.chdir(path.join(__dirname, '../../extra/')); const CliRunner = common.require('runner/cli/cli.js'); - let runner = new CliRunner({ + const runner = new CliRunner({ config: './nightwatch.json', reporter: 'junit', env: 'mixed,mixed' @@ -279,7 +279,7 @@ describe('test Parallel Execution', function() { it('testParallelExecutionWithWorkers and multiple environments - child process', function() { const CliRunner = common.require('runner/cli/cli.js'); - let runner = new CliRunner({ + const runner = new CliRunner({ reporter: 'junit', config: path.join(__dirname, '../../extra/parallelism-auto.json'), env: 'default,default' @@ -294,7 +294,7 @@ describe('test Parallel Execution', function() { it('testParallelExecutionWithWorkers and multiple environments - worker threads', function() { const CliRunner = common.require('runner/cli/cli.js'); - let runner = new CliRunner({ + const runner = new CliRunner({ reporter: 'junit', config: path.join(__dirname, '../../extra/parallelism-auto.json'), env: 'default,default' @@ -310,7 +310,7 @@ describe('test Parallel Execution', function() { it('test parallel execution with workers count - child process', function() { const CliRunner = common.require('runner/cli/cli.js'); - let runner = new CliRunner({ + const runner = new CliRunner({ reporter: 'junit', config: path.join(__dirname, '../../extra/parallelism-count.json') }); @@ -329,7 +329,7 @@ describe('test Parallel Execution', function() { it('test parallel execution with workers count - worker threads', function() { const CliRunner = common.require('runner/cli/cli.js'); - let runner = new CliRunner({ + const runner = new CliRunner({ reporter: 'junit', config: path.join(__dirname, '../../extra/parallelism-count.json') }); @@ -349,7 +349,7 @@ describe('test Parallel Execution', function() { it('test parallel execution with workers=count arg', function() { const CliRunner = common.require('runner/cli/cli.js'); - let runner = new CliRunner({ + const runner = new CliRunner({ reporter: 'junit', config: path.join(__dirname, '../../extra/parallelism-count.json'), workers: 2 @@ -364,7 +364,7 @@ describe('test Parallel Execution', function() { it('test parallel execution with workers count and extended envs', function() { const CliRunner = common.require('runner/cli/cli.js'); - let runner = new CliRunner({ + const runner = new CliRunner({ reporter: 'junit', config: path.join(__dirname, '../../extra/parallelism-workers.conf.js'), env: 'chrome' @@ -382,7 +382,7 @@ describe('test Parallel Execution', function() { it('test parallel execution with workers disabled per environment', function() { const CliRunner = common.require('runner/cli/cli.js'); - let runner = new CliRunner({ + const runner = new CliRunner({ reporter: 'junit', config: path.join(__dirname, '../../extra/parallelism-disabled.json') }); @@ -394,7 +394,7 @@ describe('test Parallel Execution', function() { it('test parallel execution with workers and single source file', function() { const CliRunner = common.require('runner/cli/cli.js'); - let runner = new CliRunner({ + const runner = new CliRunner({ reporter: 'junit', config: path.join(__dirname, '../../extra/parallelism.json'), _source: [path.join(__dirname, '../../../sampletests/async/test/sample.js')] @@ -408,7 +408,7 @@ describe('test Parallel Execution', function() { it('test parallel execution with workers and single source folder', function() { const CliRunner = common.require('runner/cli/cli.js'); - let runner = new CliRunner({ + const runner = new CliRunner({ reporter: 'junit', config: path.join(__dirname, '../../extra/parallelism.json'), _source: path.join(__dirname, '../../../sampletests/before-after') diff --git a/test/src/runner/cli/testCliRunnerParallel.js b/test/src/runner/cli/testCliRunnerParallel.js index 31e45a4252..13ecb1dde7 100644 --- a/test/src/runner/cli/testCliRunnerParallel.js +++ b/test/src/runner/cli/testCliRunnerParallel.js @@ -126,7 +126,7 @@ describe('Test CLI Runner in Parallel', function () { setTimeout(()=>{ numberOfTasks++; reject(new Error('Nigtwatch custom error')); - }, 10*(numberOfTasks+1)); + }, 10 * (numberOfTasks + 1)); })); return Promise.resolve(0); diff --git a/test/src/runner/cucumber-integration/testCliArgs.js b/test/src/runner/cucumber-integration/testCliArgs.js index c87ca2e4db..cf16847624 100644 --- a/test/src/runner/cucumber-integration/testCliArgs.js +++ b/test/src/runner/cucumber-integration/testCliArgs.js @@ -42,7 +42,7 @@ describe('Cucumber cli arguments', function(){ let index = cliArgs.indexOf('--require-module') + 1; assert.strictEqual(cliArgs[index], 'coffeescript/register'); - index = cliArgs.indexOf('--require-module', index)+1; + index = cliArgs.indexOf('--require-module', index) + 1; assert.strictEqual(cliArgs[index], 'ts-node/register'); }); @@ -59,17 +59,17 @@ describe('Cucumber cli arguments', function(){ assert.strictEqual(cliArgs.length, 21); assert.ok(cliArgs.includes('--name')); - assert.strictEqual(cliArgs[cliArgs.indexOf('--name')+1], 'sample'); + assert.strictEqual(cliArgs[cliArgs.indexOf('--name') + 1], 'sample'); assert.ok(cliArgs.includes('--fail-fast')); assert.ok(cliArgs.includes('--retry')); - assert.strictEqual(cliArgs[cliArgs.indexOf('--retry')+1], 2); + assert.strictEqual(cliArgs[cliArgs.indexOf('--retry') + 1], 2); assert.ok(cliArgs.includes('--retry-tag-filter')); - assert.strictEqual(cliArgs[cliArgs.indexOf('--retry-tag-filter')+1], '@nightwatch'); + assert.strictEqual(cliArgs[cliArgs.indexOf('--retry-tag-filter') + 1], '@nightwatch'); assert.ok(cliArgs.includes('--profile')); - assert.strictEqual(cliArgs[cliArgs.indexOf('--profile')+1], 'local'); + assert.strictEqual(cliArgs[cliArgs.indexOf('--profile') + 1], 'local'); assert.ok(cliArgs.includes('--no-strict')); assert.ok(cliArgs.includes('--parallel')); - assert.strictEqual(cliArgs[cliArgs.indexOf('--parallel')+1], 3); + assert.strictEqual(cliArgs[cliArgs.indexOf('--parallel') + 1], 3); assert.ok(cliArgs.includes('--require')); }); @@ -127,8 +127,8 @@ describe('Cucumber cli arguments', function(){ assert.ok(cliArgs.includes('--retry')); assert.ok(cliArgs.includes('--format')); - assert.strictEqual(cliArgs[cliArgs.indexOf('--retry')+1], 3); - assert.strictEqual(cliArgs[cliArgs.indexOf('--format')+1], '@cucumber/pretty-formatter'); + assert.strictEqual(cliArgs[cliArgs.indexOf('--retry') + 1], 3); + assert.strictEqual(cliArgs[cliArgs.indexOf('--format') + 1], '@cucumber/pretty-formatter'); }); it('Cucumber cli arg --enable-esm', function(){