From b0f8bc9d8f743a0fb37d83e24e61eb6f6a8f5ee5 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 25 Jul 2017 10:37:08 -0700 Subject: [PATCH] test: adjust indentation for stricter linting ESLint 4.x has stricter linting than previous versions. We are currently using the legacy indentation rules in the test directory. This commit changes the indentation of files to comply with the stricter 4.x linting and enable stricter linting in the test directory. Backport-PR-URL: https://github.com/nodejs/node/pull/14835 PR-URL: https://github.com/nodejs/node/pull/14431 Reviewed-By: Refael Ackermann Reviewed-By: Vse Mozhet Byt Reviewed-By: Trevor Norris --- test/.eslintrc.yaml | 10 ++ test/debugger/test-debugger-client.js | 4 +- test/inspector/inspector-helper.js | 26 ++-- test/inspector/test-inspector.js | 22 ++-- .../test-http-path-contains-unicode.js | 6 +- test/known_issues/test-vm-proxy-failure-CP.js | 6 +- test/message/throw_in_line_with_tabs.js | 2 +- test/parallel/test-assert.js | 8 +- test/parallel/test-buffer-alloc.js | 10 +- test/parallel/test-buffer-concat.js | 8 +- test/parallel/test-buffer-fill.js | 58 ++++----- test/parallel/test-buffer-includes.js | 12 +- test/parallel/test-buffer-indexof.js | 26 ++-- test/parallel/test-buffer-isencoding.js | 20 +-- test/parallel/test-buffer-read-noassert.js | 6 +- test/parallel/test-buffer-read.js | 6 +- test/parallel/test-buffer.js | 16 +-- .../test-child-process-spawn-argv0.js | 2 +- .../test-child-process-spawnsync-timeout.js | 2 +- test/parallel/test-cluster-eaccess.js | 2 +- .../test-crypto-cipheriv-decipheriv.js | 18 +-- test/parallel/test-crypto-fips.js | 2 +- test/parallel/test-crypto-hash.js | 8 +- test/parallel/test-domain-nested.js | 2 +- .../test-domain-uncaught-exception.js | 4 +- test/parallel/test-domain.js | 2 +- test/parallel/test-file-write-stream3.js | 8 +- test/parallel/test-fs-watchfile.js | 28 ++-- test/parallel/test-handle-wrap-isrefed-tty.js | 2 +- test/parallel/test-handle-wrap-isrefed.js | 8 +- test/parallel/test-http-header-read.js | 6 +- test/parallel/test-http-parser.js | 36 +++--- test/parallel/test-http-set-trailers.js | 4 +- test/parallel/test-http-should-keep-alive.js | 2 +- test/parallel/test-https-strict.js | 4 +- test/parallel/test-intl.js | 2 +- .../test-module-loading-globalpaths.js | 10 +- test/parallel/test-os.js | 36 +++--- test/parallel/test-path.js | 92 +++++++------- test/parallel/test-preload.js | 4 +- .../test-promises-unhandled-rejections.js | 4 +- test/parallel/test-querystring.js | 12 +- test/parallel/test-repl-mode.js | 2 +- test/parallel/test-repl-use-global.js | 6 +- test/parallel/test-repl.js | 28 ++-- test/parallel/test-require-extensions-main.js | 6 +- test/parallel/test-require-resolve.js | 12 +- test/parallel/test-setproctitle.js | 4 +- test/parallel/test-stdin-child-proc.js | 6 +- test/parallel/test-stdout-to-file.js | 2 +- test/parallel/test-stream-writev.js | 2 +- test/parallel/test-tls-client-verify.js | 44 +++---- test/parallel/test-tls-ecdh-disable.js | 2 +- test/parallel/test-tls-ecdh.js | 2 +- test/parallel/test-tls-econnreset.js | 6 +- test/parallel/test-tls-ocsp-callback.js | 2 +- test/parallel/test-tls-pfx-gh-5100-regr.js | 2 +- test/parallel/test-tls-server-verify.js | 120 +++++++++--------- test/parallel/test-tls-set-ciphers.js | 2 +- test/parallel/test-tls-sni-option.js | 2 +- test/parallel/test-util-inherits.js | 2 +- test/parallel/test-util-inspect-simd.js | 44 +++---- test/parallel/test-util-inspect.js | 77 ++++++----- test/parallel/test-util-sigint-watchdog.js | 6 +- .../test-vm-sigint-existing-handler.js | 4 +- test/parallel/test-vm-sigint.js | 4 +- .../parallel/test-zlib-convenience-methods.js | 8 +- test/parallel/test-zlib.js | 2 +- test/pummel/test-dtrace-jsstack.js | 2 +- test/pummel/test-fs-watch-file.js | 91 +++++++------ test/pummel/test-hash-seed.js | 2 +- .../test-dgram-bind-shared-ports.js | 20 +-- .../test-domain-abort-on-uncaught.js | 2 +- test/sequential/test-fs-watch.js | 72 +++++------ test/sequential/test-regress-GH-877.js | 6 +- test/timers/test-timers-reliability.js | 2 +- 76 files changed, 580 insertions(+), 560 deletions(-) diff --git a/test/.eslintrc.yaml b/test/.eslintrc.yaml index 4fea04d632f2d4..aaf3b378c035ad 100644 --- a/test/.eslintrc.yaml +++ b/test/.eslintrc.yaml @@ -1,6 +1,16 @@ ## Test-specific linter rules rules: + # Stylistic Issues + # http://eslint.org/docs/rules/#stylistic-issues + indent: [error, 2, {ArrayExpression: first, + CallExpression: {arguments: first}, + FunctionDeclaration: {parameters: first}, + FunctionExpression: {parameters: first}, + MemberExpression: off, + ObjectExpression: first, + SwitchCase: 1}] + indent-legacy: off # ECMAScript 6 # http://eslint.org/docs/rules/#ecmascript-6 no-var: 2 diff --git a/test/debugger/test-debugger-client.js b/test/debugger/test-debugger-client.js index 89b22bc2a054fc..7ebf3c7a4325ab 100644 --- a/test/debugger/test-debugger-client.js +++ b/test/debugger/test-debugger-client.js @@ -181,8 +181,8 @@ function doTest(cb, done) { c.end(); c.on('end', function() { console.error( - '>>> killing node process %d\n\n', - nodeProcess.pid); + '>>> killing node process %d\n\n', + nodeProcess.pid); nodeProcess.kill(); done(); }); diff --git a/test/inspector/inspector-helper.js b/test/inspector/inspector-helper.js index e34f2870357bd2..88f2431c760c48 100644 --- a/test/inspector/inspector-helper.js +++ b/test/inspector/inspector-helper.js @@ -43,8 +43,8 @@ function send(socket, message, id, callback) { for (let i = 0; i < messageBuf.length; i++) messageBuf[i] = messageBuf[i] ^ (1 << (i % 4)); socket.write( - Buffer.concat([wsHeaderBuf.slice(0, maskOffset + 4), messageBuf]), - callback); + Buffer.concat([wsHeaderBuf.slice(0, maskOffset + 4), messageBuf]), + callback); } function parseWSFrame(buffer, handler) { @@ -65,7 +65,7 @@ function parseWSFrame(buffer, handler) { if (buffer.length < bodyOffset + dataLen) return 0; const message = JSON.parse( - buffer.slice(bodyOffset, bodyOffset + dataLen).toString('utf8')); + buffer.slice(bodyOffset, bodyOffset + dataLen).toString('utf8')); if (DEBUG) console.log('[received]', JSON.stringify(message)); handler(message); @@ -214,7 +214,7 @@ TestSession.prototype.sendInspectorCommands = function(commands) { this.sendAll_(commands, () => { timeoutId = setTimeout(() => { common.fail(`Messages without response: ${ - Object.keys(this.messages_).join(', ')}`); + Object.keys(this.messages_).join(', ')}`); }, TIMEOUT); }); }); @@ -237,7 +237,7 @@ TestSession.prototype.expectMessages = function(expects) { if (!(expects instanceof Array)) expects = [ expects ]; const callback = this.createCallbackWithTimeout_( - `Matching response was not received:\n${expects[0]}`); + `Matching response was not received:\n${expects[0]}`); this.messagefilter_ = (message) => { if (expects[0](message)) expects.shift(); @@ -251,8 +251,8 @@ TestSession.prototype.expectMessages = function(expects) { TestSession.prototype.expectStderrOutput = function(regexp) { this.harness_.addStderrFilter( - regexp, - this.createCallbackWithTimeout_(`Timed out waiting for ${regexp}`)); + regexp, + this.createCallbackWithTimeout_(`Timed out waiting for ${regexp}`)); return this; }; @@ -293,10 +293,10 @@ TestSession.prototype.disconnect = function(childDone) { TestSession.prototype.testHttpResponse = function(path, check) { return this.enqueue((callback) => - checkHttpResponse(this.harness_.port, path, (err, response) => { - check.call(this, err, response); - callback(); - })); + checkHttpResponse(this.harness_.port, path, (err, response) => { + check.call(this, err, response); + callback(); + })); }; @@ -310,7 +310,7 @@ function Harness(port, childProcess) { this.running_ = true; childProcess.stdout.on('data', makeBufferingDataCallback( - (line) => console.log('[out]', line))); + (line) => console.log('[out]', line))); childProcess.stderr.on('data', makeBufferingDataCallback((message) => { @@ -427,7 +427,7 @@ Harness.prototype.expectShutDown = function(errorCode) { exports.startNodeForInspectorTest = function(callback) { const child = spawn(process.execPath, - [ '--inspect', '--debug-brk', mainScript ]); + [ '--inspect', '--debug-brk', mainScript ]); const timeoutId = timeout('Child process did not start properly', 4); diff --git a/test/inspector/test-inspector.js b/test/inspector/test-inspector.js index 59d6d4cf71d796..597fbe9da275d0 100644 --- a/test/inspector/test-inspector.js +++ b/test/inspector/test-inspector.js @@ -112,17 +112,17 @@ function testBreakpointOnStart(session) { function testSetBreakpointAndResume(session) { console.log('[test]', 'Setting a breakpoint and verifying it is hit'); const commands = [ - { 'method': 'Debugger.setBreakpointByUrl', - 'params': { 'lineNumber': 5, - 'url': session.mainScriptPath, - 'columnNumber': 0, - 'condition': '' - } - }, - { 'method': 'Debugger.resume'}, - [ { 'method': 'Debugger.getScriptSource', - 'params': { 'scriptId': session.mainScriptId } }, - expectMainScriptSource ], + { 'method': 'Debugger.setBreakpointByUrl', + 'params': { 'lineNumber': 5, + 'url': session.mainScriptPath, + 'columnNumber': 0, + 'condition': '' + } + }, + { 'method': 'Debugger.resume'}, + [ { 'method': 'Debugger.getScriptSource', + 'params': { 'scriptId': session.mainScriptId } }, + expectMainScriptSource ], ]; session .sendInspectorCommands(commands) diff --git a/test/known_issues/test-http-path-contains-unicode.js b/test/known_issues/test-http-path-contains-unicode.js index 8f90a0d57f07b4..68b66b7c6940ed 100644 --- a/test/known_issues/test-http-path-contains-unicode.js +++ b/test/known_issues/test-http-path-contains-unicode.js @@ -11,9 +11,9 @@ const http = require('http'); const expected = '/café🐶'; assert.strictEqual( - expected, - '/caf\u{e9}\u{1f436}', - 'Sanity check that string literal produced the expected string' + expected, + '/caf\u{e9}\u{1f436}', + 'Sanity check that string literal produced the expected string' ); const server = http.createServer(common.mustCall(function(req, res) { diff --git a/test/known_issues/test-vm-proxy-failure-CP.js b/test/known_issues/test-vm-proxy-failure-CP.js index de644599b233b8..ac73a1475bb449 100644 --- a/test/known_issues/test-vm-proxy-failure-CP.js +++ b/test/known_issues/test-vm-proxy-failure-CP.js @@ -9,9 +9,9 @@ const assert = require('assert'); const vm = require('vm'); const handler = { - getOwnPropertyDescriptor: (target, prop) => { - throw new Error('whoops'); - } + getOwnPropertyDescriptor: (target, prop) => { + throw new Error('whoops'); + } }; const sandbox = new Proxy({foo: 'bar'}, handler); const context = vm.createContext(sandbox); diff --git a/test/message/throw_in_line_with_tabs.js b/test/message/throw_in_line_with_tabs.js index 2281b61fc355cd..ad95d66e97ec55 100644 --- a/test/message/throw_in_line_with_tabs.js +++ b/test/message/throw_in_line_with_tabs.js @@ -1,4 +1,4 @@ -/* eslint-disable indent-legacy, no-tabs */ +/* eslint-disable indent, no-tabs */ 'use strict'; require('../common'); diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js index ac55f6f5113857..145760dfa35d13 100644 --- a/test/parallel/test-assert.js +++ b/test/parallel/test-assert.js @@ -399,10 +399,10 @@ assert.throws(() => { threw = false; try { assert.throws( - function() { - throw ({}); - }, - Array + function() { + throw ({}); + }, + Array ); } catch (e) { threw = true; diff --git a/test/parallel/test-buffer-alloc.js b/test/parallel/test-buffer-alloc.js index 39ce4c4a928109..57271ed0f60a95 100644 --- a/test/parallel/test-buffer-alloc.js +++ b/test/parallel/test-buffer-alloc.js @@ -743,7 +743,7 @@ assert.strictEqual('', x.inspect()); // Call .fill() first, stops valgrind warning about uninitialized memory reads. Buffer.allocUnsafe(3.3).fill().toString(); - // throws bad argument error in commit 43cb4ec +// throws bad argument error in commit 43cb4ec Buffer.alloc(3.3).fill().toString(); assert.strictEqual(Buffer.allocUnsafe(-1).length, 0); assert.strictEqual(Buffer.allocUnsafe(NaN).length, 0); @@ -782,8 +782,8 @@ Buffer.from(Buffer.allocUnsafe(0), 0, 0); 'ucs-2', 'utf16le', 'utf-16le' ].forEach(function(enc) { - assert.strictEqual(Buffer.isEncoding(enc), true); - }); + assert.strictEqual(Buffer.isEncoding(enc), true); +}); [ 'utf9', 'utf-7', @@ -797,8 +797,8 @@ Buffer.from(Buffer.allocUnsafe(0), 0, 0); 1, 0, -1 ].forEach(function(enc) { - assert.strictEqual(Buffer.isEncoding(enc), false); - }); + assert.strictEqual(Buffer.isEncoding(enc), false); +}); // GH-5110 { diff --git a/test/parallel/test-buffer-concat.js b/test/parallel/test-buffer-concat.js index 1016dd8103447d..366328863f04aa 100644 --- a/test/parallel/test-buffer-concat.js +++ b/test/parallel/test-buffer-concat.js @@ -40,8 +40,8 @@ function assertWrongList(value) { } const random10 = common.hasCrypto - ? require('crypto').randomBytes(10) - : Buffer.alloc(10, 1); + ? require('crypto').randomBytes(10) + : Buffer.alloc(10, 1); const empty = Buffer.alloc(0); assert.notDeepStrictEqual(random10, empty); @@ -58,5 +58,5 @@ assert.deepStrictEqual(Buffer.concat([random10, empty, empty]), random10); assert.deepStrictEqual(Buffer.concat([empty], 100), Buffer.alloc(100)); assert.deepStrictEqual(Buffer.concat([empty], 4096), Buffer.alloc(4096)); assert.deepStrictEqual( - Buffer.concat([random10], 40), - Buffer.concat([random10, Buffer.alloc(30)])); + Buffer.concat([random10], 40), + Buffer.concat([random10, Buffer.alloc(30)])); diff --git a/test/parallel/test-buffer-fill.js b/test/parallel/test-buffer-fill.js index 06a9044bec3103..8de05bc5dcd9ac 100644 --- a/test/parallel/test-buffer-fill.js +++ b/test/parallel/test-buffer-fill.js @@ -135,7 +135,7 @@ testBufs('61c8b462c8b563c8b6', 12, 1, 'hex'); // Make sure this operation doesn't go on forever buf1.fill('yKJh', 'hex'); assert.throws(() => - buf1.fill('\u0222', 'hex'), /^TypeError: Invalid hex string$/); + buf1.fill('\u0222', 'hex'), /^TypeError: Invalid hex string$/); // BASE64 @@ -183,23 +183,23 @@ deepStrictEqualValues(genBuffer(4, [hexBufFill, 1, -1]), [0, 0, 0, 0]); // Check exceptions assert.throws(() => buf1.fill(0, -1), /^RangeError: Out of range index$/); assert.throws(() => - buf1.fill(0, 0, buf1.length + 1), + buf1.fill(0, 0, buf1.length + 1), /^RangeError: Out of range index$/); assert.throws(() => buf1.fill('', -1), /^RangeError: Out of range index$/); assert.throws(() => - buf1.fill('', 0, buf1.length + 1), + buf1.fill('', 0, buf1.length + 1), /^RangeError: Out of range index$/); assert.throws(() => - buf1.fill('a', 0, buf1.length, 'node rocks!'), + buf1.fill('a', 0, buf1.length, 'node rocks!'), /^TypeError: Unknown encoding: node rocks!$/); assert.throws(() => - buf1.fill('a', 0, 0, NaN), + buf1.fill('a', 0, 0, NaN), /^TypeError: encoding must be a string$/); assert.throws(() => - buf1.fill('a', 0, 0, null), + buf1.fill('a', 0, 0, null), /^TypeError: encoding must be a string$/); assert.throws(() => - buf1.fill('a', 0, 0, 'foo'), /^TypeError: Unknown encoding: foo$/); + buf1.fill('a', 0, 0, 'foo'), /^TypeError: Unknown encoding: foo$/); function genBuffer(size, args) { @@ -270,10 +270,10 @@ function testBufs(string, offset, length, encoding) { // Make sure these throw. assert.throws(() => - Buffer.allocUnsafe(8).fill('a', -1), + Buffer.allocUnsafe(8).fill('a', -1), /^RangeError: Out of range index$/); assert.throws(() => - Buffer.allocUnsafe(8).fill('a', 0, 9), + Buffer.allocUnsafe(8).fill('a', 0, 9), /^RangeError: Out of range index$/); // Make sure this doesn't hang indefinitely. @@ -396,36 +396,36 @@ assert.throws(() => { }, /^RangeError: out of range index$/); assert.deepStrictEqual( - Buffer.allocUnsafeSlow(16).fill('ab', 'utf16le'), - Buffer.from('61006200610062006100620061006200', 'hex')); + Buffer.allocUnsafeSlow(16).fill('ab', 'utf16le'), + Buffer.from('61006200610062006100620061006200', 'hex')); assert.deepStrictEqual( - Buffer.allocUnsafeSlow(15).fill('ab', 'utf16le'), - Buffer.from('610062006100620061006200610062', 'hex')); + Buffer.allocUnsafeSlow(15).fill('ab', 'utf16le'), + Buffer.from('610062006100620061006200610062', 'hex')); assert.deepStrictEqual( - Buffer.allocUnsafeSlow(16).fill('ab', 'utf16le'), - Buffer.from('61006200610062006100620061006200', 'hex')); + Buffer.allocUnsafeSlow(16).fill('ab', 'utf16le'), + Buffer.from('61006200610062006100620061006200', 'hex')); assert.deepStrictEqual( - Buffer.allocUnsafeSlow(16).fill('a', 'utf16le'), - Buffer.from('61006100610061006100610061006100', 'hex')); + Buffer.allocUnsafeSlow(16).fill('a', 'utf16le'), + Buffer.from('61006100610061006100610061006100', 'hex')); assert.strictEqual( - Buffer.allocUnsafeSlow(16).fill('a', 'utf16le').toString('utf16le'), - 'a'.repeat(8)); + Buffer.allocUnsafeSlow(16).fill('a', 'utf16le').toString('utf16le'), + 'a'.repeat(8)); assert.strictEqual( - Buffer.allocUnsafeSlow(16).fill('a', 'latin1').toString('latin1'), - 'a'.repeat(16)); + Buffer.allocUnsafeSlow(16).fill('a', 'latin1').toString('latin1'), + 'a'.repeat(16)); assert.strictEqual( - Buffer.allocUnsafeSlow(16).fill('a', 'utf8').toString('utf8'), - 'a'.repeat(16)); + Buffer.allocUnsafeSlow(16).fill('a', 'utf8').toString('utf8'), + 'a'.repeat(16)); assert.strictEqual( - Buffer.allocUnsafeSlow(16).fill('Љ', 'utf16le').toString('utf16le'), - 'Љ'.repeat(8)); + Buffer.allocUnsafeSlow(16).fill('Љ', 'utf16le').toString('utf16le'), + 'Љ'.repeat(8)); assert.strictEqual( - Buffer.allocUnsafeSlow(16).fill('Љ', 'latin1').toString('latin1'), - '\t'.repeat(16)); + Buffer.allocUnsafeSlow(16).fill('Љ', 'latin1').toString('latin1'), + '\t'.repeat(16)); assert.strictEqual( - Buffer.allocUnsafeSlow(16).fill('Љ', 'utf8').toString('utf8'), - 'Љ'.repeat(8)); + Buffer.allocUnsafeSlow(16).fill('Љ', 'utf8').toString('utf8'), + 'Љ'.repeat(8)); diff --git a/test/parallel/test-buffer-includes.js b/test/parallel/test-buffer-includes.js index 142602ab46cb9f..e610bc7e59fa33 100644 --- a/test/parallel/test-buffer-includes.js +++ b/test/parallel/test-buffer-includes.js @@ -154,11 +154,11 @@ assert(mixedByteStringUcs2.includes('\u03a3', 0, 'ucs2')); assert(!mixedByteStringUcs2.includes('\u0396', 0, 'ucs2')); assert.ok( - mixedByteStringUcs2.includes(Buffer.from('bc', 'ucs2'), 0, 'ucs2')); + mixedByteStringUcs2.includes(Buffer.from('bc', 'ucs2'), 0, 'ucs2')); assert.ok( - mixedByteStringUcs2.includes(Buffer.from('\u03a3', 'ucs2'), 0, 'ucs2')); + mixedByteStringUcs2.includes(Buffer.from('\u03a3', 'ucs2'), 0, 'ucs2')); assert.ok( - !mixedByteStringUcs2.includes(Buffer.from('\u0396', 'ucs2'), 0, 'ucs2')); + !mixedByteStringUcs2.includes(Buffer.from('\u0396', 'ucs2'), 0, 'ucs2')); twoByteString = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'ucs2'); @@ -208,7 +208,7 @@ assert(longBufferString.includes(pattern, 512), 'Long JABACABA..., Second J'); // Search for a non-ASCII string in a pure ASCII string. const asciiString = Buffer.from( - 'arglebargleglopglyfarglebargleglopglyfarglebargleglopglyf'); + 'arglebargleglopglyfarglebargleglopglyfarglebargleglopglyf'); assert(!asciiString.includes('\x2061')); assert(asciiString.includes('leb', 0)); @@ -263,11 +263,11 @@ for (let lengthIndex = 0; lengthIndex < lengths.length; lengthIndex++) { const patternBufferUcs2 = allCharsBufferUcs2.slice(index, index + length); assert.ok( - allCharsBufferUcs2.includes(patternBufferUcs2, 0, 'ucs2')); + allCharsBufferUcs2.includes(patternBufferUcs2, 0, 'ucs2')); const patternStringUcs2 = patternBufferUcs2.toString('ucs2'); assert.ok( - allCharsBufferUcs2.includes(patternStringUcs2, 0, 'ucs2')); + allCharsBufferUcs2.includes(patternStringUcs2, 0, 'ucs2')); } } diff --git a/test/parallel/test-buffer-indexof.js b/test/parallel/test-buffer-indexof.js index 7aab6e609e56d7..4e0547ba950f4d 100644 --- a/test/parallel/test-buffer-indexof.js +++ b/test/parallel/test-buffer-indexof.js @@ -198,11 +198,11 @@ assert.strictEqual(10, mixedByteStringUcs2.indexOf('\u03a3', 0, 'ucs2')); assert.strictEqual(-1, mixedByteStringUcs2.indexOf('\u0396', 0, 'ucs2')); assert.strictEqual( - 6, mixedByteStringUcs2.indexOf(Buffer.from('bc', 'ucs2'), 0, 'ucs2')); + 6, mixedByteStringUcs2.indexOf(Buffer.from('bc', 'ucs2'), 0, 'ucs2')); assert.strictEqual( - 10, mixedByteStringUcs2.indexOf(Buffer.from('\u03a3', 'ucs2'), 0, 'ucs2')); + 10, mixedByteStringUcs2.indexOf(Buffer.from('\u03a3', 'ucs2'), 0, 'ucs2')); assert.strictEqual( - -1, mixedByteStringUcs2.indexOf(Buffer.from('\u0396', 'ucs2'), 0, 'ucs2')); + -1, mixedByteStringUcs2.indexOf(Buffer.from('\u0396', 'ucs2'), 0, 'ucs2')); { const twoByteString = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'ucs2'); @@ -222,13 +222,13 @@ assert.strictEqual( // Test multi-char pattern assert.strictEqual( - 0, twoByteString.indexOf('\u039a\u0391', 0, 'ucs2'), 'Lambda Alpha'); + 0, twoByteString.indexOf('\u039a\u0391', 0, 'ucs2'), 'Lambda Alpha'); assert.strictEqual( - 2, twoByteString.indexOf('\u0391\u03a3', 0, 'ucs2'), 'Alpha Sigma'); + 2, twoByteString.indexOf('\u0391\u03a3', 0, 'ucs2'), 'Alpha Sigma'); assert.strictEqual( - 4, twoByteString.indexOf('\u03a3\u03a3', 0, 'ucs2'), 'Sigma Sigma'); + 4, twoByteString.indexOf('\u03a3\u03a3', 0, 'ucs2'), 'Sigma Sigma'); assert.strictEqual( - 6, twoByteString.indexOf('\u03a3\u0395', 0, 'ucs2'), 'Sigma Epsilon'); + 6, twoByteString.indexOf('\u03a3\u0395', 0, 'ucs2'), 'Sigma Epsilon'); } const mixedByteStringUtf8 = Buffer.from('\u039a\u0391abc\u03a3\u03a3\u0395'); @@ -258,17 +258,17 @@ for (let i = 0; i < longBufferString.length - pattern.length; i += 7) { assert.strictEqual(510, longBufferString.indexOf('AJABACA'), 'Long AJABACA, First J'); assert.strictEqual( - 1534, longBufferString.indexOf('AJABACA', 511), 'Long AJABACA, Second J'); + 1534, longBufferString.indexOf('AJABACA', 511), 'Long AJABACA, Second J'); pattern = 'JABACABADABACABA'; assert.strictEqual( - 511, longBufferString.indexOf(pattern), 'Long JABACABA..., First J'); + 511, longBufferString.indexOf(pattern), 'Long JABACABA..., First J'); assert.strictEqual( - 1535, longBufferString.indexOf(pattern, 512), 'Long JABACABA..., Second J'); + 1535, longBufferString.indexOf(pattern, 512), 'Long JABACABA..., Second J'); // Search for a non-ASCII string in a pure ASCII string. const asciiString = Buffer.from( - 'arglebargleglopglyfarglebargleglopglyfarglebargleglopglyf'); + 'arglebargleglopglyfarglebargleglopglyfarglebargleglopglyf'); assert.strictEqual(-1, asciiString.indexOf('\x2061')); assert.strictEqual(3, asciiString.indexOf('leb', 0)); @@ -335,11 +335,11 @@ assert.strictEqual(Buffer.from('aaaaa').indexOf('b', 'ucs2'), -1); const patternBufferUcs2 = allCharsBufferUcs2.slice(index, index + length); assert.strictEqual( - index, allCharsBufferUcs2.indexOf(patternBufferUcs2, 0, 'ucs2')); + index, allCharsBufferUcs2.indexOf(patternBufferUcs2, 0, 'ucs2')); const patternStringUcs2 = patternBufferUcs2.toString('ucs2'); assert.strictEqual( - index, allCharsBufferUcs2.indexOf(patternStringUcs2, 0, 'ucs2')); + index, allCharsBufferUcs2.indexOf(patternStringUcs2, 0, 'ucs2')); } } } diff --git a/test/parallel/test-buffer-isencoding.js b/test/parallel/test-buffer-isencoding.js index 4ed380aae1ce69..e67d1c078397a3 100644 --- a/test/parallel/test-buffer-isencoding.js +++ b/test/parallel/test-buffer-isencoding.js @@ -3,7 +3,8 @@ require('../common'); const assert = require('assert'); -[ 'hex', +[ + 'hex', 'utf8', 'utf-8', 'ascii', @@ -13,11 +14,13 @@ const assert = require('assert'); 'ucs2', 'ucs-2', 'utf16le', - 'utf-16le' ].forEach((enc) => { - assert.strictEqual(Buffer.isEncoding(enc), true); - }); + 'utf-16le' +].forEach((enc) => { + assert.strictEqual(Buffer.isEncoding(enc), true); +}); -[ 'utf9', +[ + 'utf9', 'utf-7', 'Unicode-FTW', 'new gnu gun', @@ -28,6 +31,7 @@ const assert = require('assert'); [], 1, 0, - -1 ].forEach((enc) => { - assert.strictEqual(Buffer.isEncoding(enc), false); - }); + -1 +].forEach((enc) => { + assert.strictEqual(Buffer.isEncoding(enc), false); +}); diff --git a/test/parallel/test-buffer-read-noassert.js b/test/parallel/test-buffer-read-noassert.js index 83d533a32031cb..0f1cd16f0cd494 100644 --- a/test/parallel/test-buffer-read-noassert.js +++ b/test/parallel/test-buffer-read-noassert.js @@ -14,9 +14,9 @@ function read(buff, funx, args, expected) { ); assert.doesNotThrow( - () => assert.strictEqual(buff[funx](...args, true), expected), - 'noAssert does not change return value for valid ranges' -); + () => assert.strictEqual(buff[funx](...args, true), expected), + 'noAssert does not change return value for valid ranges' + ); } diff --git a/test/parallel/test-buffer-read.js b/test/parallel/test-buffer-read.js index 53e53dd49e2a84..d3a1c941422e51 100644 --- a/test/parallel/test-buffer-read.js +++ b/test/parallel/test-buffer-read.js @@ -14,9 +14,9 @@ function read(buff, funx, args, expected) { ); assert.doesNotThrow( - () => assert.strictEqual(buff[funx](...args, true), expected), - 'noAssert does not change return value for valid ranges' -); + () => assert.strictEqual(buff[funx](...args, true), expected), + 'noAssert does not change return value for valid ranges' + ); } diff --git a/test/parallel/test-buffer.js b/test/parallel/test-buffer.js index a2fdab55b772a8..c2d1be0dd49042 100644 --- a/test/parallel/test-buffer.js +++ b/test/parallel/test-buffer.js @@ -1047,15 +1047,15 @@ Buffer(Buffer(0), 0, 0); 'ucs-2', 'utf16le', 'utf-16le' ].forEach(function(enc) { - assert.strictEqual(Buffer.isEncoding(enc), true); - }); + assert.strictEqual(Buffer.isEncoding(enc), true); +}); [ 'utf9', 'utf-7', 'Unicode-FTW', 'new gnu gun' ].forEach(function(enc) { - assert.strictEqual(Buffer.isEncoding(enc), false); - }); + assert.strictEqual(Buffer.isEncoding(enc), false); +}); // GH-5110 @@ -1183,16 +1183,16 @@ assert.throws(function() { const buf = new Buffer([0xFF, 0xFF, 0xFF, 0xFF]); assert.strictEqual(buf['readUInt' + bits + 'BE'](0), - (0xFFFFFFFF >>> (32 - bits))); + (0xFFFFFFFF >>> (32 - bits))); assert.strictEqual(buf['readUInt' + bits + 'LE'](0), - (0xFFFFFFFF >>> (32 - bits))); + (0xFFFFFFFF >>> (32 - bits))); assert.strictEqual(buf['readInt' + bits + 'BE'](0), - (0xFFFFFFFF >> (32 - bits))); + (0xFFFFFFFF >> (32 - bits))); assert.strictEqual(buf['readInt' + bits + 'LE'](0), - (0xFFFFFFFF >> (32 - bits))); + (0xFFFFFFFF >> (32 - bits))); }); // test for common read(U)IntLE/BE diff --git a/test/parallel/test-child-process-spawn-argv0.js b/test/parallel/test-child-process-spawn-argv0.js index 593ba9e48ce492..b556c8bcf6ba32 100644 --- a/test/parallel/test-child-process-spawn-argv0.js +++ b/test/parallel/test-child-process-spawn-argv0.js @@ -14,5 +14,5 @@ const noArgv0 = cp.spawnSync(process.execPath, [__filename, 'child']); assert.strictEqual(noArgv0.stdout.toString().trim(), process.execPath); const withArgv0 = cp.spawnSync(process.execPath, [__filename, 'child'], - {argv0: 'withArgv0'}); + {argv0: 'withArgv0'}); assert.strictEqual(withArgv0.stdout.toString().trim(), 'withArgv0'); diff --git a/test/parallel/test-child-process-spawnsync-timeout.js b/test/parallel/test-child-process-spawnsync-timeout.js index 38f22deef26ae7..b1a9c10fa53631 100644 --- a/test/parallel/test-child-process-spawnsync-timeout.js +++ b/test/parallel/test-child-process-spawnsync-timeout.js @@ -17,7 +17,7 @@ switch (process.argv[2]) { default: const start = Date.now(); const ret = spawnSync(process.execPath, [__filename, 'child'], - {timeout: TIMER}); + {timeout: TIMER}); assert.strictEqual(ret.error.errno, 'ETIMEDOUT'); const end = Date.now() - start; assert(end < SLEEP); diff --git a/test/parallel/test-cluster-eaccess.js b/test/parallel/test-cluster-eaccess.js index 66ea101556db18..4cc9fd83005da7 100644 --- a/test/parallel/test-cluster-eaccess.js +++ b/test/parallel/test-cluster-eaccess.js @@ -38,7 +38,7 @@ if (cluster.isMaster) { } else { common.refreshTmpDir(); const cp = fork(`${common.fixturesDir}/listen-on-socket-and-exit.js`, - { stdio: 'inherit' }); + { stdio: 'inherit' }); // message from the child indicates it's ready and listening cp.on('message', common.mustCall(function() { diff --git a/test/parallel/test-crypto-cipheriv-decipheriv.js b/test/parallel/test-crypto-cipheriv-decipheriv.js index 7c1fad34bfe1c6..b6b2978973412b 100644 --- a/test/parallel/test-crypto-cipheriv-decipheriv.js +++ b/test/parallel/test-crypto-cipheriv-decipheriv.js @@ -71,9 +71,9 @@ const errMessage = /Invalid IV length/; // But non-empty IVs should be rejected. for (let n = 1; n < 256; n += 1) { assert.throws( - () => crypto.createCipheriv('aes-128-ecb', Buffer.alloc(16), - Buffer.alloc(n)), - errMessage); + () => crypto.createCipheriv('aes-128-ecb', Buffer.alloc(16), + Buffer.alloc(n)), + errMessage); } // Correctly sized IV should be accepted in CBC mode. @@ -83,16 +83,16 @@ crypto.createCipheriv('aes-128-cbc', Buffer.alloc(16), Buffer.alloc(16)); for (let n = 0; n < 256; n += 1) { if (n === 16) continue; assert.throws( - () => crypto.createCipheriv('aes-128-cbc', Buffer.alloc(16), - Buffer.alloc(n)), - errMessage); + () => crypto.createCipheriv('aes-128-cbc', Buffer.alloc(16), + Buffer.alloc(n)), + errMessage); } // Zero-sized IV should be rejected in GCM mode. assert.throws( - () => crypto.createCipheriv('aes-128-gcm', Buffer.alloc(16), - Buffer.alloc(0)), - errMessage); + () => crypto.createCipheriv('aes-128-gcm', Buffer.alloc(16), + Buffer.alloc(0)), + errMessage); // But all other IV lengths should be accepted. for (let n = 1; n < 256; n += 1) { diff --git a/test/parallel/test-crypto-fips.js b/test/parallel/test-crypto-fips.js index 6dffbe3e1352b3..eaeda15ba98044 100644 --- a/test/parallel/test-crypto-fips.js +++ b/test/parallel/test-crypto-fips.js @@ -43,7 +43,7 @@ function testHelper(stream, args, expectedOutput, cmd, env) { console.error( `Spawned child [pid:${child.pid}] with cmd '${cmd}' expect %j with args '${ - args}' OPENSSL_CONF=%j`, expectedOutput, env.OPENSSL_CONF); + args}' OPENSSL_CONF=%j`, expectedOutput, env.OPENSSL_CONF); function childOk(child) { console.error(`Child #${++num_children_ok} [pid:${child.pid}] OK.`); diff --git a/test/parallel/test-crypto-hash.js b/test/parallel/test-crypto-hash.js index 28f0f2f30349ba..16cc9c9fc5e41c 100644 --- a/test/parallel/test-crypto-hash.js +++ b/test/parallel/test-crypto-hash.js @@ -96,13 +96,13 @@ assert.throws(function() { // Default UTF-8 encoding const hutf8 = crypto.createHash('sha512').update('УТФ-8 text').digest('hex'); assert.strictEqual( - hutf8, - '4b21bbd1a68e690a730ddcb5a8bc94ead9879ffe82580767ad7ec6fa8ba2dea6' + + hutf8, + '4b21bbd1a68e690a730ddcb5a8bc94ead9879ffe82580767ad7ec6fa8ba2dea6' + '43a821af66afa9a45b6a78c712fecf0e56dc7f43aef4bcfc8eb5b4d8dca6ea5b'); assert.notStrictEqual( - hutf8, - crypto.createHash('sha512').update('УТФ-8 text', 'latin1').digest('hex')); + hutf8, + crypto.createHash('sha512').update('УТФ-8 text', 'latin1').digest('hex')); const h3 = crypto.createHash('sha256'); h3.digest(); diff --git a/test/parallel/test-domain-nested.js b/test/parallel/test-domain-nested.js index 6d673adc7e6387..62d632d363ade4 100644 --- a/test/parallel/test-domain-nested.js +++ b/test/parallel/test-domain-nested.js @@ -13,7 +13,7 @@ domain.create().run(function() { domain.create().run(function() { domain.create().run(function() { domain.create().on('error', function(e) { - // Don't need to do anything here + // Don't need to do anything here }).run(function() { throw new Error('died'); }); diff --git a/test/parallel/test-domain-uncaught-exception.js b/test/parallel/test-domain-uncaught-exception.js index bb6dd33e37b73a..0d50e999ec63bf 100644 --- a/test/parallel/test-domain-uncaught-exception.js +++ b/test/parallel/test-domain-uncaught-exception.js @@ -185,14 +185,14 @@ if (process.argv[2] === 'child') { if (test.messagesReceived === undefined || test.messagesReceived.indexOf(expectedMessage) === -1) assert(false, `test ${test.fn.name} should have sent message: ${ - expectedMessage} but didn't`); + expectedMessage} but didn't`); }); if (test.messagesReceived) { test.messagesReceived.forEach(function(receivedMessage) { if (!test.expectedMessages.includes(receivedMessage)) { assert(false, `test ${test.fn.name} should not have sent message: ${ - receivedMessage} but did`); + receivedMessage} but did`); } }); } diff --git a/test/parallel/test-domain.js b/test/parallel/test-domain.js index 0233eb88eb268b..8c5bf08b14bc10 100644 --- a/test/parallel/test-domain.js +++ b/test/parallel/test-domain.js @@ -60,7 +60,7 @@ d.on('error', function(er) { break; case - "ENOENT: no such file or directory, open 'stream for nonexistent file'": + "ENOENT: no such file or directory, open 'stream for nonexistent file'": assert.strictEqual(typeof er.errno, 'number'); assert.strictEqual(er.code, 'ENOENT'); assert.strictEqual(er_path, 'stream for nonexistent file'); diff --git a/test/parallel/test-file-write-stream3.js b/test/parallel/test-file-write-stream3.js index 89ec1a7379981e..8550cd0305ae4b 100644 --- a/test/parallel/test-file-write-stream3.js +++ b/test/parallel/test-file-write-stream3.js @@ -156,10 +156,10 @@ function run_test_3() { const run_test_4 = common.mustCall(function() { // Error: start must be >= zero assert.throws( - function() { - fs.createWriteStream(filepath, { start: -5, flags: 'r+' }); - }, - /"start" must be/ + function() { + fs.createWriteStream(filepath, { start: -5, flags: 'r+' }); + }, + /"start" must be/ ); }); diff --git a/test/parallel/test-fs-watchfile.js b/test/parallel/test-fs-watchfile.js index c99510fcbb4fe9..f2d873a3fd7340 100644 --- a/test/parallel/test-fs-watchfile.js +++ b/test/parallel/test-fs-watchfile.js @@ -20,20 +20,20 @@ assert.throws(function() { const enoentFile = path.join(common.tmpDir, 'non-existent-file'); const expectedStatObject = new fs.Stats( - 0, // dev - 0, // mode - 0, // nlink - 0, // uid - 0, // gid - 0, // rdev - common.isWindows ? undefined : 0, // blksize - 0, // ino - 0, // size - common.isWindows ? undefined : 0, // blocks - Date.UTC(1970, 0, 1, 0, 0, 0), // atime - Date.UTC(1970, 0, 1, 0, 0, 0), // mtime - Date.UTC(1970, 0, 1, 0, 0, 0), // ctime - Date.UTC(1970, 0, 1, 0, 0, 0) // birthtime + 0, // dev + 0, // mode + 0, // nlink + 0, // uid + 0, // gid + 0, // rdev + common.isWindows ? undefined : 0, // blksize + 0, // ino + 0, // size + common.isWindows ? undefined : 0, // blocks + Date.UTC(1970, 0, 1, 0, 0, 0), // atime + Date.UTC(1970, 0, 1, 0, 0, 0), // mtime + Date.UTC(1970, 0, 1, 0, 0, 0), // ctime + Date.UTC(1970, 0, 1, 0, 0, 0) // birthtime ); common.refreshTmpDir(); diff --git a/test/parallel/test-handle-wrap-isrefed-tty.js b/test/parallel/test-handle-wrap-isrefed-tty.js index ad312be1f77862..1aeaf7d8473e49 100644 --- a/test/parallel/test-handle-wrap-isrefed-tty.js +++ b/test/parallel/test-handle-wrap-isrefed-tty.js @@ -20,7 +20,7 @@ if (process.argv[2] === 'child') { tty.unref(); assert(tty._handle.hasRef(), false); tty._handle.close( - common.mustCall(() => assert(tty._handle.hasRef(), false))); + common.mustCall(() => assert(tty._handle.hasRef(), false))); return; } diff --git a/test/parallel/test-handle-wrap-isrefed.js b/test/parallel/test-handle-wrap-isrefed.js index b5dbeb23bfd63a..66dcb281717bcf 100644 --- a/test/parallel/test-handle-wrap-isrefed.js +++ b/test/parallel/test-handle-wrap-isrefed.js @@ -39,7 +39,7 @@ function makeAssert(message) { sock4.ref(); assert(sock4._handle.hasRef(), true); sock4._handle.close( - common.mustCall(() => assert(sock4._handle.hasRef(), false))); + common.mustCall(() => assert(sock4._handle.hasRef(), false))); const sock6 = dgram.createSocket('udp6'); assert(Object.getPrototypeOf(sock6._handle).hasOwnProperty('hasRef'), true); @@ -49,7 +49,7 @@ function makeAssert(message) { sock6.ref(); assert(sock6._handle.hasRef(), true); sock6._handle.close( - common.mustCall(() => assert(sock6._handle.hasRef(), false))); + common.mustCall(() => assert(sock6._handle.hasRef(), false))); } @@ -83,7 +83,7 @@ function makeAssert(message) { assert(server._handle.hasRef(), true); assert(server._unref, false); server._handle.close( - common.mustCall(() => assert(server._handle.hasRef(), false))); + common.mustCall(() => assert(server._handle.hasRef(), false))); } @@ -97,5 +97,5 @@ function makeAssert(message) { timer.ref(); assert(timer._handle.hasRef(), true); timer._handle.close( - common.mustCall(() => assert(timer._handle.hasRef(), false))); + common.mustCall(() => assert(timer._handle.hasRef(), false))); } diff --git a/test/parallel/test-http-header-read.js b/test/parallel/test-http-header-read.js index 5465fd30f272be..1fd075c2aab613 100644 --- a/test/parallel/test-http-header-read.js +++ b/test/parallel/test-http-header-read.js @@ -17,9 +17,9 @@ const s = http.createServer(function(req, res) { // This checks that after the headers have been sent, getHeader works // and does not throw an exception (Issue 752) assert.doesNotThrow( - function() { - assert.strictEqual(plain, res.getHeader(contentType)); - } + function() { + assert.strictEqual(plain, res.getHeader(contentType)); + } ); }); diff --git a/test/parallel/test-http-parser.js b/test/parallel/test-http-parser.js index 74f8abfa3b70c8..92ff0c9dbde436 100644 --- a/test/parallel/test-http-parser.js +++ b/test/parallel/test-http-parser.js @@ -110,7 +110,7 @@ function expectBody(expected) { // { const request = Buffer.from( - 'HTTP/1.1 200 OK' + CRLF + + 'HTTP/1.1 200 OK' + CRLF + 'Content-Type: text/plain' + CRLF + 'Content-Length: 4' + CRLF + CRLF + @@ -167,7 +167,7 @@ function expectBody(expected) { // { const request = Buffer.from( - 'POST /it HTTP/1.1' + CRLF + + 'POST /it HTTP/1.1' + CRLF + 'Transfer-Encoding: chunked' + CRLF + CRLF + '4' + CRLF + @@ -214,7 +214,7 @@ function expectBody(expected) { // { const request = Buffer.from( - 'GET / HTTP/1.0' + CRLF + + 'GET / HTTP/1.0' + CRLF + 'X-Filler: 1337' + CRLF + 'X-Filler: 42' + CRLF + 'X-Filler2: 42' + CRLF + @@ -227,8 +227,8 @@ function expectBody(expected) { assert.strictEqual(versionMajor, 1); assert.strictEqual(versionMinor, 0); assert.deepStrictEqual( - headers || parser.headers, - ['X-Filler', '1337', 'X-Filler', '42', 'X-Filler2', '42']); + headers || parser.headers, + ['X-Filler', '1337', 'X-Filler', '42', 'X-Filler2', '42']); }; const parser = newParser(REQUEST); @@ -245,7 +245,7 @@ function expectBody(expected) { const lots_of_headers = `X-Filler: 42${CRLF}`.repeat(256); const request = Buffer.from( - 'GET /foo/bar/baz?quux=42#1337 HTTP/1.0' + CRLF + + 'GET /foo/bar/baz?quux=42#1337 HTTP/1.0' + CRLF + lots_of_headers + CRLF); @@ -277,7 +277,7 @@ function expectBody(expected) { // { const request = Buffer.from( - 'POST /it HTTP/1.1' + CRLF + + 'POST /it HTTP/1.1' + CRLF + 'Content-Type: application/x-www-form-urlencoded' + CRLF + 'Content-Length: 15' + CRLF + CRLF + @@ -309,7 +309,7 @@ function expectBody(expected) { // { const request = Buffer.from( - 'POST /it HTTP/1.1' + CRLF + + 'POST /it HTTP/1.1' + CRLF + 'Content-Type: text/plain' + CRLF + 'Transfer-Encoding: chunked' + CRLF + CRLF + @@ -350,7 +350,7 @@ function expectBody(expected) { // { let request = Buffer.from( - 'POST /it HTTP/1.1' + CRLF + + 'POST /it HTTP/1.1' + CRLF + 'Content-Type: text/plain' + CRLF + 'Transfer-Encoding: chunked' + CRLF + CRLF + @@ -383,7 +383,7 @@ function expectBody(expected) { parser.execute(request, 0, request.length); request = Buffer.from( - '9' + CRLF + + '9' + CRLF + '123456789' + CRLF + 'C' + CRLF + '123456789ABC' + CRLF + @@ -400,7 +400,7 @@ function expectBody(expected) { // { const request = Buffer.from( - 'POST /helpme HTTP/1.1' + CRLF + + 'POST /helpme HTTP/1.1' + CRLF + 'Content-Type: text/plain' + CRLF + 'Transfer-Encoding: chunked' + CRLF + CRLF + @@ -458,7 +458,7 @@ function expectBody(expected) { // { const request = Buffer.from( - 'POST /it HTTP/1.1' + CRLF + + 'POST /it HTTP/1.1' + CRLF + 'Content-Type: text/plain' + CRLF + 'Transfer-Encoding: chunked' + CRLF + CRLF + @@ -482,8 +482,8 @@ function expectBody(expected) { assert.strictEqual(versionMajor, 1); assert.strictEqual(versionMinor, 1); assert.deepStrictEqual( - headers || parser.headers, - ['Content-Type', 'text/plain', 'Transfer-Encoding', 'chunked']); + headers || parser.headers, + ['Content-Type', 'text/plain', 'Transfer-Encoding', 'chunked']); }; let expected_body = '123123456123456789123456789ABC123456789ABCDEF'; @@ -511,7 +511,7 @@ function expectBody(expected) { // { const req1 = Buffer.from( - 'PUT /this HTTP/1.1' + CRLF + + 'PUT /this HTTP/1.1' + CRLF + 'Content-Type: text/plain' + CRLF + 'Transfer-Encoding: chunked' + CRLF + CRLF + @@ -520,7 +520,7 @@ function expectBody(expected) { '0' + CRLF); const req2 = Buffer.from( - 'POST /that HTTP/1.0' + CRLF + + 'POST /that HTTP/1.0' + CRLF + 'Content-Type: text/plain' + CRLF + 'Content-Length: 4' + CRLF + CRLF + @@ -534,8 +534,8 @@ function expectBody(expected) { assert.strictEqual(versionMajor, 1); assert.strictEqual(versionMinor, 1); assert.deepStrictEqual( - headers, - ['Content-Type', 'text/plain', 'Transfer-Encoding', 'chunked']); + headers, + ['Content-Type', 'text/plain', 'Transfer-Encoding', 'chunked']); }; const onHeadersComplete2 = (versionMajor, versionMinor, headers, diff --git a/test/parallel/test-http-set-trailers.js b/test/parallel/test-http-set-trailers.js index 3197d8d0520438..5000a25b07397a 100644 --- a/test/parallel/test-http-set-trailers.js +++ b/test/parallel/test-http-set-trailers.js @@ -63,8 +63,8 @@ server.on('listening', function() { outstanding_reqs--; clearTimeout(tid); assert.ok( - /0\r\nx-foo: bar\r\n\r\n$/.test(res_buffer), - 'No trailer in HTTP/1.1 response.' + /0\r\nx-foo: bar\r\n\r\n$/.test(res_buffer), + 'No trailer in HTTP/1.1 response.' ); if (outstanding_reqs === 0) { server.close(); diff --git a/test/parallel/test-http-should-keep-alive.js b/test/parallel/test-http-should-keep-alive.js index 5dfcbdd4707fc3..4a9ff8e2a538e3 100644 --- a/test/parallel/test-http-should-keep-alive.js +++ b/test/parallel/test-http-should-keep-alive.js @@ -33,7 +33,7 @@ const server = net.createServer(function(socket) { assert.strictEqual( req.shouldKeepAlive, SHOULD_KEEP_ALIVE[responses], `${SERVER_RESPONSES[responses]} should ${ - SHOULD_KEEP_ALIVE[responses] ? '' : 'not '}Keep-Alive`); + SHOULD_KEEP_ALIVE[responses] ? '' : 'not '}Keep-Alive`); ++responses; if (responses < SHOULD_KEEP_ALIVE.length) { makeRequest(); diff --git a/test/parallel/test-https-strict.js b/test/parallel/test-https-strict.js index 765887f2af0e78..8d14d903941c77 100644 --- a/test/parallel/test-https-strict.js +++ b/test/parallel/test-https-strict.js @@ -128,9 +128,9 @@ function makeReq(path, port, error, host, ca) { const req = https.get(options); expectResponseCount++; const server = port === server1.address().port ? server1 - : port === server2.address().port ? server2 + : port === server2.address().port ? server2 : port === server3.address().port ? server3 - : null; + : null; if (!server) throw new Error(`invalid port: ${port}`); server.expectCount++; diff --git a/test/parallel/test-intl.js b/test/parallel/test-intl.js index 2113728682829d..d9543904c32c6c 100644 --- a/test/parallel/test-intl.js +++ b/test/parallel/test-intl.js @@ -28,7 +28,7 @@ if (!haveIntl) { } else { const erMsg = `"Intl" object is present but v8_enable_i18n_support is ${ - enablei18n}. Is this test out of date?`; + enablei18n}. Is this test out of date?`; assert.strictEqual(enablei18n, 1, erMsg); // Construct a new date at the beginning of Unix time diff --git a/test/parallel/test-module-loading-globalpaths.js b/test/parallel/test-module-loading-globalpaths.js index 418e5ac4753c0a..c12228ece763bf 100644 --- a/test/parallel/test-module-loading-globalpaths.js +++ b/test/parallel/test-module-loading-globalpaths.js @@ -47,11 +47,11 @@ if (process.argv[2] === 'child') { fs.mkdirSync(noPkgHomeDir); env['HOME'] = env['USERPROFILE'] = noPkgHomeDir; assert.throws( - () => { - child_process.execFileSync(testExecPath, [ __filename, 'child' ], - { encoding: 'utf8', env: env }); - }, - new RegExp(`Cannot find module '${pkgName}'`)); + () => { + child_process.execFileSync(testExecPath, [ __filename, 'child' ], + { encoding: 'utf8', env: env }); + }, + new RegExp(`Cannot find module '${pkgName}'`)); // Test module in $HOME/.node_modules. const modHomeDir = path.join(testFixturesDir, 'home-pkg-in-node_modules'); diff --git a/test/parallel/test-os.js b/test/parallel/test-os.js index 447d88c164456e..db5a137eb54ef4 100644 --- a/test/parallel/test-os.js +++ b/test/parallel/test-os.js @@ -103,25 +103,25 @@ const interfaces = os.networkInterfaces(); console.error(interfaces); switch (platform) { case 'linux': - { - const filter = (e) => e.address === '127.0.0.1'; - const actual = interfaces.lo.filter(filter); - const expected = [{ address: '127.0.0.1', netmask: '255.0.0.0', - mac: '00:00:00:00:00:00', family: 'IPv4', - internal: true }]; - assert.deepStrictEqual(actual, expected); - break; - } + { + const filter = (e) => e.address === '127.0.0.1'; + const actual = interfaces.lo.filter(filter); + const expected = [{ address: '127.0.0.1', netmask: '255.0.0.0', + mac: '00:00:00:00:00:00', family: 'IPv4', + internal: true }]; + assert.deepStrictEqual(actual, expected); + break; + } case 'win32': - { - const filter = (e) => e.address === '127.0.0.1'; - const actual = interfaces['Loopback Pseudo-Interface 1'].filter(filter); - const expected = [{ address: '127.0.0.1', netmask: '255.0.0.0', - mac: '00:00:00:00:00:00', family: 'IPv4', - internal: true }]; - assert.deepStrictEqual(actual, expected); - break; - } + { + const filter = (e) => e.address === '127.0.0.1'; + const actual = interfaces['Loopback Pseudo-Interface 1'].filter(filter); + const expected = [{ address: '127.0.0.1', netmask: '255.0.0.0', + mac: '00:00:00:00:00:00', family: 'IPv4', + internal: true }]; + assert.deepStrictEqual(actual, expected); + break; + } } const EOL = os.EOL; diff --git a/test/parallel/test-path.js b/test/parallel/test-path.js index 825f10d49d4153..531b5d69e7b483 100644 --- a/test/parallel/test-path.js +++ b/test/parallel/test-path.js @@ -286,51 +286,51 @@ joinTests.push([ path.win32.join, joinTests[0][1].slice(0).concat( [// arguments result - // UNC path expected - [['//foo/bar'], '\\\\foo\\bar\\'], - [['\\/foo/bar'], '\\\\foo\\bar\\'], - [['\\\\foo/bar'], '\\\\foo\\bar\\'], - // UNC path expected - server and share separate - [['//foo', 'bar'], '\\\\foo\\bar\\'], - [['//foo/', 'bar'], '\\\\foo\\bar\\'], - [['//foo', '/bar'], '\\\\foo\\bar\\'], - // UNC path expected - questionable - [['//foo', '', 'bar'], '\\\\foo\\bar\\'], - [['//foo/', '', 'bar'], '\\\\foo\\bar\\'], - [['//foo/', '', '/bar'], '\\\\foo\\bar\\'], - // UNC path expected - even more questionable - [['', '//foo', 'bar'], '\\\\foo\\bar\\'], - [['', '//foo/', 'bar'], '\\\\foo\\bar\\'], - [['', '//foo/', '/bar'], '\\\\foo\\bar\\'], - // No UNC path expected (no double slash in first component) - [['\\', 'foo/bar'], '\\foo\\bar'], - [['\\', '/foo/bar'], '\\foo\\bar'], - [['', '/', '/foo/bar'], '\\foo\\bar'], - // No UNC path expected (no non-slashes in first component - - // questionable) - [['//', 'foo/bar'], '\\foo\\bar'], - [['//', '/foo/bar'], '\\foo\\bar'], - [['\\\\', '/', '/foo/bar'], '\\foo\\bar'], - [['//'], '/'], - // No UNC path expected (share name missing - questionable). - [['//foo'], '\\foo'], - [['//foo/'], '\\foo\\'], - [['//foo', '/'], '\\foo\\'], - [['//foo', '', '/'], '\\foo\\'], - // No UNC path expected (too many leading slashes - questionable) - [['///foo/bar'], '\\foo\\bar'], - [['////foo', 'bar'], '\\foo\\bar'], - [['\\\\\\/foo/bar'], '\\foo\\bar'], - // Drive-relative vs drive-absolute paths. This merely describes the - // status quo, rather than being obviously right - [['c:'], 'c:.'], - [['c:.'], 'c:.'], - [['c:', ''], 'c:.'], - [['', 'c:'], 'c:.'], - [['c:.', '/'], 'c:.\\'], - [['c:.', 'file'], 'c:file'], - [['c:', '/'], 'c:\\'], - [['c:', 'file'], 'c:\\file'] + // UNC path expected + [['//foo/bar'], '\\\\foo\\bar\\'], + [['\\/foo/bar'], '\\\\foo\\bar\\'], + [['\\\\foo/bar'], '\\\\foo\\bar\\'], + // UNC path expected - server and share separate + [['//foo', 'bar'], '\\\\foo\\bar\\'], + [['//foo/', 'bar'], '\\\\foo\\bar\\'], + [['//foo', '/bar'], '\\\\foo\\bar\\'], + // UNC path expected - questionable + [['//foo', '', 'bar'], '\\\\foo\\bar\\'], + [['//foo/', '', 'bar'], '\\\\foo\\bar\\'], + [['//foo/', '', '/bar'], '\\\\foo\\bar\\'], + // UNC path expected - even more questionable + [['', '//foo', 'bar'], '\\\\foo\\bar\\'], + [['', '//foo/', 'bar'], '\\\\foo\\bar\\'], + [['', '//foo/', '/bar'], '\\\\foo\\bar\\'], + // No UNC path expected (no double slash in first component) + [['\\', 'foo/bar'], '\\foo\\bar'], + [['\\', '/foo/bar'], '\\foo\\bar'], + [['', '/', '/foo/bar'], '\\foo\\bar'], + // No UNC path expected (no non-slashes in first component - + // questionable) + [['//', 'foo/bar'], '\\foo\\bar'], + [['//', '/foo/bar'], '\\foo\\bar'], + [['\\\\', '/', '/foo/bar'], '\\foo\\bar'], + [['//'], '/'], + // No UNC path expected (share name missing - questionable). + [['//foo'], '\\foo'], + [['//foo/'], '\\foo\\'], + [['//foo', '/'], '\\foo\\'], + [['//foo', '', '/'], '\\foo\\'], + // No UNC path expected (too many leading slashes - questionable) + [['///foo/bar'], '\\foo\\bar'], + [['////foo', 'bar'], '\\foo\\bar'], + [['\\\\\\/foo/bar'], '\\foo\\bar'], + // Drive-relative vs drive-absolute paths. This merely describes the + // status quo, rather than being obviously right + [['c:'], 'c:.'], + [['c:.'], 'c:.'], + [['c:', ''], 'c:.'], + [['', 'c:'], 'c:.'], + [['c:.', '/'], 'c:.\\'], + [['c:.', 'file'], 'c:file'], + [['c:', '/'], 'c:\\'], + [['c:', 'file'], 'c:\\file'] ] ) ]); @@ -466,7 +466,7 @@ resolveTests.forEach((test) => { const expected = test[1]; const message = `path.${os}.resolve(${test[0].map(JSON.stringify).join(',')})\n expect=${ - JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`; + JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`; if (actual !== expected && actualAlt !== expected) failures.push(`\n${message}`); }); diff --git a/test/parallel/test-preload.js b/test/parallel/test-preload.js index 2b1695f1e41f8d..95d41d36323178 100644 --- a/test/parallel/test-preload.js +++ b/test/parallel/test-preload.js @@ -106,7 +106,7 @@ replProc.on('close', function(code) { // also test that duplicated preload only gets loaded once childProcess.exec( `"${nodeBinary}" ${preloadOption([fixtureA])}-e "console.log('hello');" ${ - preloadOption([fixtureA, fixtureB])}`, + preloadOption([fixtureA, fixtureB])}`, function(err, stdout, stderr) { if (err) throw err; assert.strictEqual(stdout, 'A\nB\nhello\n'); @@ -127,7 +127,7 @@ interactive.stdin.write('process.exit()\n'); childProcess.exec( `"${nodeBinary}" --require "${fixture('cluster-preload.js')}" "${ - fixture('cluster-preload-test.js')}"`, + fixture('cluster-preload-test.js')}"`, function(err, stdout, stderr) { if (err) throw err; assert.ok(/worker terminated with code 43/.test(stdout)); diff --git a/test/parallel/test-promises-unhandled-rejections.js b/test/parallel/test-promises-unhandled-rejections.js index 8fe3d46864ee24..d976493e87c563 100644 --- a/test/parallel/test-promises-unhandled-rejections.js +++ b/test/parallel/test-promises-unhandled-rejections.js @@ -12,8 +12,8 @@ const asyncTest = (function() { function fail(error) { const stack = currentTest - ? `${error.stack}\nFrom previous event:\n${currentTest.stack}` - : error.stack; + ? `${error.stack}\nFrom previous event:\n${currentTest.stack}` + : error.stack; if (currentTest) process.stderr.write(`'${currentTest.description}' failed\n\n`); diff --git a/test/parallel/test-querystring.js b/test/parallel/test-querystring.js index 6b636c337927de..bee4030ea1d1bd 100644 --- a/test/parallel/test-querystring.js +++ b/test/parallel/test-querystring.js @@ -252,8 +252,8 @@ check(qs.parse('a', null, []), { '': 'a' }); // Test limiting assert.strictEqual( - Object.keys(qs.parse('a=1&b=1&c=1', null, null, { maxKeys: 1 })).length, - 1); + Object.keys(qs.parse('a=1&b=1&c=1', null, null, { maxKeys: 1 })).length, + 1); // Test removing limit { @@ -275,7 +275,7 @@ assert.strictEqual( { const b = qs.unescapeBuffer('%d3%f2Ug%1f6v%24%5e%98%cb' + '%0d%ac%a2%2f%9d%eb%d8%a2%e6'); -// + // assert.strictEqual(0xd3, b[0]); assert.strictEqual(0xf2, b[1]); assert.strictEqual(0x55, b[2]); @@ -313,9 +313,9 @@ assert.strictEqual(qs.unescapeBuffer('a%%').toString(), 'a%%'); } check(qs.parse('a=a&b=b&c=c', null, null, {decodeURIComponent: demoDecode}), - {aa: 'aa', bb: 'bb', cc: 'cc'}); + {aa: 'aa', bb: 'bb', cc: 'cc'}); check(qs.parse('a=a&b=b&c=c', null, '==', {decodeURIComponent: (str) => str}), - {'a=a': '', 'b=b': '', 'c=c': ''}); + {'a=a': '', 'b=b': '', 'c=c': ''}); } // Test QueryString.unescape @@ -325,7 +325,7 @@ assert.strictEqual(qs.unescapeBuffer('a%%').toString(), 'a%%'); } check(qs.parse('a=a', null, null, {decodeURIComponent: errDecode}), - {a: 'a'}); + {a: 'a'}); } // Test custom encode diff --git a/test/parallel/test-repl-mode.js b/test/parallel/test-repl-mode.js index cf492a7e4b3f93..9a0773153b5d34 100644 --- a/test/parallel/test-repl-mode.js +++ b/test/parallel/test-repl-mode.js @@ -32,7 +32,7 @@ function testStrictMode() { cli.input.emit('data', 'x = 3\n'); assert.ok(/ReferenceError: x is not defined/.test( - cli.output.accumulator.join(''))); + cli.output.accumulator.join(''))); cli.output.accumulator.length = 0; cli.input.emit('data', 'let y = 3\n'); diff --git a/test/parallel/test-repl-use-global.js b/test/parallel/test-repl-use-global.js index 79e13cd819aeb6..c76505272b2682 100644 --- a/test/parallel/test-repl-use-global.js +++ b/test/parallel/test-repl-use-global.js @@ -80,7 +80,7 @@ function runRepl(useGlobal, testFunc, cb) { }; repl.createInternalRepl( - process.env, - opts, - testFunc(useGlobal, cb, opts.output)); + process.env, + opts, + testFunc(useGlobal, cb, opts.output)); } diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index 6fc9d020185c77..5baa2cd5fbba89 100644 --- a/test/parallel/test-repl.js +++ b/test/parallel/test-repl.js @@ -65,9 +65,9 @@ function error_test() { read_buffer += data.toString('ascii', 0, data.length); console.error( `Unix data: ${JSON.stringify(read_buffer)}, expecting ${ - client_unix.expect.exec ? - client_unix.expect : - JSON.stringify(client_unix.expect)}`); + client_unix.expect.exec ? + client_unix.expect : + JSON.stringify(client_unix.expect)}`); if (read_buffer.includes(prompt_unix)) { // if it's an exact match, then don't do the regexp @@ -248,7 +248,7 @@ function error_test() { // do not fail when a String is created with line continuation { client: client_unix, send: '\'the\\\nfourth\\\neye\'', expect: `${prompt_multiline}${prompt_multiline}'thefourtheye'\n${ - prompt_unix}` }, + prompt_unix}` }, // Don't fail when a partial String is created and line continuation is used // with whitespace characters at the end of the string. We are to ignore it. // This test is to make sure that we properly remove the whitespace @@ -258,11 +258,11 @@ function error_test() { // multiline strings preserve whitespace characters in them { client: client_unix, send: '\'the \\\n fourth\t\t\\\n eye \'', expect: `${prompt_multiline}${ - prompt_multiline}'the fourth\\t\\t eye '\n${prompt_unix}` }, + prompt_multiline}'the fourth\\t\\t eye '\n${prompt_unix}` }, // more than one multiline strings also should preserve whitespace chars { client: client_unix, send: '\'the \\\n fourth\' + \'\t\t\\\n eye \'', expect: `${prompt_multiline}${ - prompt_multiline}'the fourth\\t\\t eye '\n${prompt_unix}` }, + prompt_multiline}'the fourth\\t\\t eye '\n${prompt_unix}` }, // using REPL commands within a string literal should still work { client: client_unix, send: '\'\\\n.break', expect: prompt_unix }, @@ -275,7 +275,7 @@ function error_test() { // empty lines in the string literals should not affect the string { client: client_unix, send: '\'the\\\n\\\nfourtheye\'\n', expect: `${prompt_multiline}${ - prompt_multiline}'thefourtheye'\n${prompt_unix}` }, + prompt_multiline}'thefourtheye'\n${prompt_unix}` }, // Regression test for https://github.com/nodejs/node/issues/597 { client: client_unix, send: '/(.)(.)(.)(.)(.)(.)(.)(.)(.)/.test(\'123456789\')\n', @@ -289,24 +289,24 @@ function error_test() { // regression tests for https://github.com/nodejs/node/issues/2749 { client: client_unix, send: 'function x() {\nreturn \'\\n\';\n }', expect: `${prompt_multiline}${prompt_multiline}undefined\n${ - prompt_unix}` }, + prompt_unix}` }, { client: client_unix, send: 'function x() {\nreturn \'\\\\\';\n }', expect: `${prompt_multiline}${prompt_multiline}undefined\n${ - prompt_unix}` }, + prompt_unix}` }, // regression tests for https://github.com/nodejs/node/issues/3421 { client: client_unix, send: 'function x() {\n//\'\n }', expect: `${prompt_multiline}${prompt_multiline}undefined\n${ - prompt_unix}` }, + prompt_unix}` }, { client: client_unix, send: 'function x() {\n//"\n }', expect: `${prompt_multiline}${prompt_multiline}undefined\n${ - prompt_unix}` }, + prompt_unix}` }, { client: client_unix, send: 'function x() {//\'\n }', expect: `${prompt_multiline}undefined\n${prompt_unix}` }, { client: client_unix, send: 'function x() {//"\n }', expect: `${prompt_multiline}undefined\n${prompt_unix}` }, { client: client_unix, send: 'function x() {\nvar i = "\'";\n }', expect: `${prompt_multiline}${prompt_multiline}undefined\n${ - prompt_unix}` }, + prompt_unix}` }, { client: client_unix, send: 'function x(/*optional*/) {}', expect: `undefined\n${prompt_unix}` }, { client: client_unix, send: 'function x(/* // 5 */) {}', @@ -427,7 +427,7 @@ function tcp_test() { client_tcp.on('data', function(data) { read_buffer += data.toString('ascii', 0, data.length); console.error(`TCP data: ${JSON.stringify(read_buffer)}, expecting ${ - JSON.stringify(client_tcp.expect)}`); + JSON.stringify(client_tcp.expect)}`); if (read_buffer.includes(prompt_tcp)) { assert.strictEqual(client_tcp.expect, read_buffer); console.error('match'); @@ -497,7 +497,7 @@ function unix_test() { client_unix.on('data', function(data) { read_buffer += data.toString('ascii', 0, data.length); console.error(`Unix data: ${JSON.stringify(read_buffer)}, expecting ${ - JSON.stringify(client_unix.expect)}`); + JSON.stringify(client_unix.expect)}`); if (read_buffer.includes(prompt_unix)) { assert.strictEqual(client_unix.expect, read_buffer); console.error('match'); diff --git a/test/parallel/test-require-extensions-main.js b/test/parallel/test-require-extensions-main.js index e8420cd26cd512..cf3d2ee183f50d 100644 --- a/test/parallel/test-require-extensions-main.js +++ b/test/parallel/test-require-extensions-main.js @@ -4,7 +4,7 @@ const common = require('../common'); const fixturesRequire = require(`${common.fixturesDir}/require-bin/bin/req.js`); assert.strictEqual( - fixturesRequire, - '', - 'test-require-extensions-main failed to import fixture requirements' + fixturesRequire, + '', + 'test-require-extensions-main failed to import fixture requirements' ); diff --git a/test/parallel/test-require-resolve.js b/test/parallel/test-require-resolve.js index 202f3c5ef87f3d..1cc87581460967 100644 --- a/test/parallel/test-require-resolve.js +++ b/test/parallel/test-require-resolve.js @@ -5,14 +5,14 @@ const assert = require('assert'); const path = require('path'); assert.strictEqual( - path.join(__dirname, '../fixtures/a.js').toLowerCase(), - require.resolve('../fixtures/a').toLowerCase()); + path.join(__dirname, '../fixtures/a.js').toLowerCase(), + require.resolve('../fixtures/a').toLowerCase()); assert.strictEqual( - path.join(fixturesDir, 'a.js').toLowerCase(), - require.resolve(path.join(fixturesDir, 'a')).toLowerCase()); + path.join(fixturesDir, 'a.js').toLowerCase(), + require.resolve(path.join(fixturesDir, 'a')).toLowerCase()); assert.strictEqual( - path.join(fixturesDir, 'nested-index', 'one', 'index.js').toLowerCase(), - require.resolve('../fixtures/nested-index/one').toLowerCase()); + path.join(fixturesDir, 'nested-index', 'one', 'index.js').toLowerCase(), + require.resolve('../fixtures/nested-index/one').toLowerCase()); assert.strictEqual('path', require.resolve('path')); console.log('ok'); diff --git a/test/parallel/test-setproctitle.js b/test/parallel/test-setproctitle.js index 179d48c0343971..cb82dfd9530379 100644 --- a/test/parallel/test-setproctitle.js +++ b/test/parallel/test-setproctitle.js @@ -23,8 +23,8 @@ assert.strictEqual(process.title, title); // To pass this test on alpine, since Busybox `ps` does not // support `-p` switch, use `ps -o` and `grep` instead. const cmd = common.isLinux ? - `ps -o pid,args | grep '${process.pid} ${title}' | grep -v grep` : - `ps -p ${process.pid} -o args=`; + `ps -o pid,args | grep '${process.pid} ${title}' | grep -v grep` : + `ps -p ${process.pid} -o args=`; exec(cmd, common.mustCall((error, stdout, stderr) => { assert.ifError(error); diff --git a/test/parallel/test-stdin-child-proc.js b/test/parallel/test-stdin-child-proc.js index 5359edc53a42ba..bbb6a29cd724c9 100644 --- a/test/parallel/test-stdin-child-proc.js +++ b/test/parallel/test-stdin-child-proc.js @@ -5,8 +5,10 @@ const common = require('../common'); const assert = require('assert'); const child_process = require('child_process'); const path = require('path'); -const cp = child_process.spawn(process.execPath, - [path.resolve(__dirname, 'test-stdin-pause-resume.js')]); +const cp = child_process.spawn( + process.execPath, + [path.resolve(__dirname, 'test-stdin-pause-resume.js')] +); cp.on('exit', common.mustCall((code) => { assert.strictEqual(code, 0); diff --git a/test/parallel/test-stdout-to-file.js b/test/parallel/test-stdout-to-file.js index 9be09cd9ab1cdc..1ad3fafe77ac22 100644 --- a/test/parallel/test-stdout-to-file.js +++ b/test/parallel/test-stdout-to-file.js @@ -14,7 +14,7 @@ common.refreshTmpDir(); function test(size, useBuffer, cb) { const cmd = `"${process.argv[0]}" "${ - useBuffer ? scriptBuffer : scriptString}" ${size} > "${tmpFile}"`; + useBuffer ? scriptBuffer : scriptString}" ${size} > "${tmpFile}"`; try { fs.unlinkSync(tmpFile); diff --git a/test/parallel/test-stream-writev.js b/test/parallel/test-stream-writev.js index 7ca0c4b8957575..d70a7d6819b74d 100644 --- a/test/parallel/test-stream-writev.js +++ b/test/parallel/test-stream-writev.js @@ -68,7 +68,7 @@ function test(decode, uncork, multi, next) { return { encoding: chunk.encoding, chunk: Buffer.isBuffer(chunk.chunk) ? - Array.prototype.slice.call(chunk.chunk) : chunk.chunk + Array.prototype.slice.call(chunk.chunk) : chunk.chunk }; }); cb(); diff --git a/test/parallel/test-tls-client-verify.js b/test/parallel/test-tls-client-verify.js index d10c0e16c548fe..9ec23d206855ca 100644 --- a/test/parallel/test-tls-client-verify.js +++ b/test/parallel/test-tls-client-verify.js @@ -17,31 +17,31 @@ const testCases = key: 'agent2-key', cert: 'agent2-cert', servers: [ - { ok: true, key: 'agent1-key', cert: 'agent1-cert' }, - { ok: false, key: 'agent2-key', cert: 'agent2-cert' }, - { ok: false, key: 'agent3-key', cert: 'agent3-cert' } - ] - }, - - { ca: [], - key: 'agent2-key', - cert: 'agent2-cert', - servers: [ - { ok: false, key: 'agent1-key', cert: 'agent1-cert' }, - { ok: false, key: 'agent2-key', cert: 'agent2-cert' }, - { ok: false, key: 'agent3-key', cert: 'agent3-cert' } + { ok: true, key: 'agent1-key', cert: 'agent1-cert' }, + { ok: false, key: 'agent2-key', cert: 'agent2-cert' }, + { ok: false, key: 'agent3-key', cert: 'agent3-cert' } ] }, - { ca: ['ca1-cert', 'ca2-cert'], - key: 'agent2-key', - cert: 'agent2-cert', - servers: [ - { ok: true, key: 'agent1-key', cert: 'agent1-cert' }, - { ok: false, key: 'agent2-key', cert: 'agent2-cert' }, - { ok: true, key: 'agent3-key', cert: 'agent3-cert' } - ] - } + { ca: [], + key: 'agent2-key', + cert: 'agent2-cert', + servers: [ + { ok: false, key: 'agent1-key', cert: 'agent1-cert' }, + { ok: false, key: 'agent2-key', cert: 'agent2-cert' }, + { ok: false, key: 'agent3-key', cert: 'agent3-cert' } + ] + }, + + { ca: ['ca1-cert', 'ca2-cert'], + key: 'agent2-key', + cert: 'agent2-cert', + servers: [ + { ok: true, key: 'agent1-key', cert: 'agent1-cert' }, + { ok: false, key: 'agent2-key', cert: 'agent2-cert' }, + { ok: true, key: 'agent3-key', cert: 'agent3-cert' } + ] + } ]; function filenamePEM(n) { diff --git a/test/parallel/test-tls-ecdh-disable.js b/test/parallel/test-tls-ecdh-disable.js index b53b98273c91dd..43dcfe58f804b7 100644 --- a/test/parallel/test-tls-ecdh-disable.js +++ b/test/parallel/test-tls-ecdh-disable.js @@ -28,7 +28,7 @@ const server = tls.createServer(options, common.mustNotCall()); server.listen(0, '127.0.0.1', common.mustCall(function() { let cmd = `"${common.opensslCli}" s_client -cipher ${ - options.ciphers} -connect 127.0.0.1:${this.address().port}`; + options.ciphers} -connect 127.0.0.1:${this.address().port}`; // for the performance and stability issue in s_client on Windows if (common.isWindows) diff --git a/test/parallel/test-tls-ecdh.js b/test/parallel/test-tls-ecdh.js index 9383f111f8da49..ee1e7a3a884a04 100644 --- a/test/parallel/test-tls-ecdh.js +++ b/test/parallel/test-tls-ecdh.js @@ -32,7 +32,7 @@ const server = tls.createServer(options, common.mustCall(function(conn) { server.listen(0, '127.0.0.1', common.mustCall(function() { let cmd = `"${common.opensslCli}" s_client -cipher ${ - options.ciphers} -connect 127.0.0.1:${this.address().port}`; + options.ciphers} -connect 127.0.0.1:${this.address().port}`; // for the performance and stability issue in s_client on Windows if (common.isWindows) diff --git a/test/parallel/test-tls-econnreset.js b/test/parallel/test-tls-econnreset.js index 0ec7264c4147e4..e54c48a46b7888 100644 --- a/test/parallel/test-tls-econnreset.js +++ b/test/parallel/test-tls-econnreset.js @@ -57,9 +57,9 @@ const server = clientError = err; }).listen(0, function() { const options = { - ciphers: 'AES128-GCM-SHA256', - port: this.address().port, - ca: ca + ciphers: 'AES128-GCM-SHA256', + port: this.address().port, + ca: ca }; tls.connect(options).on('error', function(err) { assert(!connectError); diff --git a/test/parallel/test-tls-ocsp-callback.js b/test/parallel/test-tls-ocsp-callback.js index 97dea67002909c..1a97f701780dbf 100644 --- a/test/parallel/test-tls-ocsp-callback.js +++ b/test/parallel/test-tls-ocsp-callback.js @@ -76,7 +76,7 @@ function test(testOptions, cb) { port: this.address().port, requestOCSP: testOptions.ocsp !== false, secureOptions: testOptions.ocsp === false ? - SSL_OP_NO_TICKET : 0, + SSL_OP_NO_TICKET : 0, rejectUnauthorized: false }, function() { clientSecure++; diff --git a/test/parallel/test-tls-pfx-gh-5100-regr.js b/test/parallel/test-tls-pfx-gh-5100-regr.js index 142a7de10b841a..83847fd8bb57d8 100644 --- a/test/parallel/test-tls-pfx-gh-5100-regr.js +++ b/test/parallel/test-tls-pfx-gh-5100-regr.js @@ -13,7 +13,7 @@ const fs = require('fs'); const path = require('path'); const pfx = fs.readFileSync( - path.join(common.fixturesDir, 'keys', 'agent1-pfx.pem')); + path.join(common.fixturesDir, 'keys', 'agent1-pfx.pem')); const server = tls.createServer({ pfx: pfx, diff --git a/test/parallel/test-tls-server-verify.js b/test/parallel/test-tls-server-verify.js index 2ecc3cc5a015d2..836f5ff6e54ebc 100644 --- a/test/parallel/test-tls-server-verify.js +++ b/test/parallel/test-tls-server-verify.js @@ -35,80 +35,80 @@ const testCases = CAs: ['ca1-cert'], clients: [{ name: 'agent1', shouldReject: false, shouldAuth: false }, - { name: 'agent2', shouldReject: false, shouldAuth: false }, - { name: 'agent3', shouldReject: false, shouldAuth: false }, - { name: 'nocert', shouldReject: false, shouldAuth: false } + { name: 'agent2', shouldReject: false, shouldAuth: false }, + { name: 'agent3', shouldReject: false, shouldAuth: false }, + { name: 'nocert', shouldReject: false, shouldAuth: false } ] }, - { title: 'Allow both authed and unauthed connections with CA1', - requestCert: true, - rejectUnauthorized: false, - renegotiate: false, - CAs: ['ca1-cert'], - clients: + { title: 'Allow both authed and unauthed connections with CA1', + requestCert: true, + rejectUnauthorized: false, + renegotiate: false, + CAs: ['ca1-cert'], + clients: [{ name: 'agent1', shouldReject: false, shouldAuth: true }, - { name: 'agent2', shouldReject: false, shouldAuth: false }, - { name: 'agent3', shouldReject: false, shouldAuth: false }, - { name: 'nocert', shouldReject: false, shouldAuth: false } + { name: 'agent2', shouldReject: false, shouldAuth: false }, + { name: 'agent3', shouldReject: false, shouldAuth: false }, + { name: 'nocert', shouldReject: false, shouldAuth: false } ] - }, + }, - { title: 'Do not request certs at connection. Do that later', - requestCert: false, - rejectUnauthorized: false, - renegotiate: true, - CAs: ['ca1-cert'], - clients: + { title: 'Do not request certs at connection. Do that later', + requestCert: false, + rejectUnauthorized: false, + renegotiate: true, + CAs: ['ca1-cert'], + clients: [{ name: 'agent1', shouldReject: false, shouldAuth: true }, - { name: 'agent2', shouldReject: false, shouldAuth: false }, - { name: 'agent3', shouldReject: false, shouldAuth: false }, - { name: 'nocert', shouldReject: false, shouldAuth: false } + { name: 'agent2', shouldReject: false, shouldAuth: false }, + { name: 'agent3', shouldReject: false, shouldAuth: false }, + { name: 'nocert', shouldReject: false, shouldAuth: false } ] - }, + }, - { title: 'Allow only authed connections with CA1', - requestCert: true, - rejectUnauthorized: true, - renegotiate: false, - CAs: ['ca1-cert'], - clients: + { title: 'Allow only authed connections with CA1', + requestCert: true, + rejectUnauthorized: true, + renegotiate: false, + CAs: ['ca1-cert'], + clients: [{ name: 'agent1', shouldReject: false, shouldAuth: true }, - { name: 'agent2', shouldReject: true }, - { name: 'agent3', shouldReject: true }, - { name: 'nocert', shouldReject: true } + { name: 'agent2', shouldReject: true }, + { name: 'agent3', shouldReject: true }, + { name: 'nocert', shouldReject: true } ] - }, + }, - { title: 'Allow only authed connections with CA1 and CA2', - requestCert: true, - rejectUnauthorized: true, - renegotiate: false, - CAs: ['ca1-cert', 'ca2-cert'], - clients: + { title: 'Allow only authed connections with CA1 and CA2', + requestCert: true, + rejectUnauthorized: true, + renegotiate: false, + CAs: ['ca1-cert', 'ca2-cert'], + clients: [{ name: 'agent1', shouldReject: false, shouldAuth: true }, - { name: 'agent2', shouldReject: true }, - { name: 'agent3', shouldReject: false, shouldAuth: true }, - { name: 'nocert', shouldReject: true } + { name: 'agent2', shouldReject: true }, + { name: 'agent3', shouldReject: false, shouldAuth: true }, + { name: 'nocert', shouldReject: true } ] - }, + }, - { title: 'Allow only certs signed by CA2 but not in the CRL', - requestCert: true, - rejectUnauthorized: true, - renegotiate: false, - CAs: ['ca2-cert'], - crl: 'ca2-crl', - clients: [ - { name: 'agent1', shouldReject: true, shouldAuth: false }, - { name: 'agent2', shouldReject: true, shouldAuth: false }, - { name: 'agent3', shouldReject: false, shouldAuth: true }, - // Agent4 has a cert in the CRL. - { name: 'agent4', shouldReject: true, shouldAuth: false }, - { name: 'nocert', shouldReject: true } - ] - } + { title: 'Allow only certs signed by CA2 but not in the CRL', + requestCert: true, + rejectUnauthorized: true, + renegotiate: false, + CAs: ['ca2-cert'], + crl: 'ca2-crl', + clients: [ + { name: 'agent1', shouldReject: true, shouldAuth: false }, + { name: 'agent2', shouldReject: true, shouldAuth: false }, + { name: 'agent3', shouldReject: false, shouldAuth: true }, + // Agent4 has a cert in the CRL. + { name: 'agent4', shouldReject: true, shouldAuth: false }, + { name: 'nocert', shouldReject: true } + ] + } ]; @@ -230,7 +230,7 @@ function runClient(prefix, port, options, cb) { assert.strictEqual( options.shouldAuth, authed, `${prefix}${options.name} authed is ${authed} but should have been ${ - options.shouldAuth}`); + options.shouldAuth}`); } cb(); @@ -296,7 +296,7 @@ function runTest(port, testIndex) { if (c.authorized) { console.error(`${prefix}- authed connection: ${ - c.getPeerCertificate().subject.CN}`); + c.getPeerCertificate().subject.CN}`); c.write('\n_authed\n'); } else { console.error(`${prefix}- unauthed connection: %s`, c.authorizationError); diff --git a/test/parallel/test-tls-set-ciphers.js b/test/parallel/test-tls-set-ciphers.js index e10bafca2aced3..f62657077f2a2f 100644 --- a/test/parallel/test-tls-set-ciphers.js +++ b/test/parallel/test-tls-set-ciphers.js @@ -35,7 +35,7 @@ const server = tls.createServer(options, common.mustCall(function(conn) { server.listen(0, '127.0.0.1', function() { let cmd = `"${common.opensslCli}" s_client -cipher ${ - options.ciphers} -connect 127.0.0.1:${this.address().port}`; + options.ciphers} -connect 127.0.0.1:${this.address().port}`; // for the performance and stability issue in s_client on Windows if (common.isWindows) diff --git a/test/parallel/test-tls-sni-option.js b/test/parallel/test-tls-sni-option.js index e1ecfb9620f5ef..9181705f6b7460 100644 --- a/test/parallel/test-tls-sni-option.js +++ b/test/parallel/test-tls-sni-option.js @@ -126,7 +126,7 @@ function startTest() { options.port = server.address().port; const client = tls.connect(options, function() { clientResults.push( - /Hostname\/IP doesn't/.test(client.authorizationError || '')); + /Hostname\/IP doesn't/.test(client.authorizationError || '')); client.destroy(); next(); diff --git a/test/parallel/test-util-inherits.js b/test/parallel/test-util-inherits.js index 13094ef695081b..9328a50344596a 100644 --- a/test/parallel/test-util-inherits.js +++ b/test/parallel/test-util-inherits.js @@ -28,7 +28,7 @@ assert.strictEqual(b.a(), 'a'); assert.strictEqual(b.b(), 'b'); assert.strictEqual(b.constructor, B); - // two levels of inheritance +// two levels of inheritance function C() { B.call(this, 'b'); this._c = 'c'; diff --git a/test/parallel/test-util-inspect-simd.js b/test/parallel/test-util-inspect-simd.js index 5e0a2740840c93..b24957a67207a2 100644 --- a/test/parallel/test-util-inspect-simd.js +++ b/test/parallel/test-util-inspect-simd.js @@ -7,56 +7,56 @@ const assert = require('assert'); const inspect = require('util').inspect; assert.strictEqual( - inspect(SIMD.Bool16x8()), - 'Bool16x8 [ false, false, false, false, false, false, false, false ]'); + inspect(SIMD.Bool16x8()), + 'Bool16x8 [ false, false, false, false, false, false, false, false ]'); assert.strictEqual( - inspect(SIMD.Bool32x4()), - 'Bool32x4 [ false, false, false, false ]'); + inspect(SIMD.Bool32x4()), + 'Bool32x4 [ false, false, false, false ]'); assert.strictEqual( - inspect(SIMD.Bool8x16()), - 'Bool8x16 [\n false,\n false,\n false,\n false,\n false,\n' + + inspect(SIMD.Bool8x16()), + 'Bool8x16 [\n false,\n false,\n false,\n false,\n false,\n' + ' false,\n false,\n false,\n false,\n false,\n false,\n' + ' false,\n false,\n false,\n false,\n false ]'); assert.strictEqual( - inspect(SIMD.Bool32x4()), - 'Bool32x4 [ false, false, false, false ]'); + inspect(SIMD.Bool32x4()), + 'Bool32x4 [ false, false, false, false ]'); assert.strictEqual( - inspect(SIMD.Float32x4()), - 'Float32x4 [ NaN, NaN, NaN, NaN ]'); + inspect(SIMD.Float32x4()), + 'Float32x4 [ NaN, NaN, NaN, NaN ]'); assert.strictEqual( - inspect(SIMD.Int16x8()), - 'Int16x8 [ 0, 0, 0, 0, 0, 0, 0, 0 ]'); + inspect(SIMD.Int16x8()), + 'Int16x8 [ 0, 0, 0, 0, 0, 0, 0, 0 ]'); assert.strictEqual( - inspect(SIMD.Int32x4()), - 'Int32x4 [ 0, 0, 0, 0 ]'); + inspect(SIMD.Int32x4()), + 'Int32x4 [ 0, 0, 0, 0 ]'); assert.strictEqual( - inspect(SIMD.Int8x16()), - 'Int8x16 [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]'); + inspect(SIMD.Int8x16()), + 'Int8x16 [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]'); // The SIMD types below are not available in v5. if (typeof SIMD.Uint16x8 === 'function') { assert.strictEqual( - inspect(SIMD.Uint16x8()), - 'Uint16x8 [ 0, 0, 0, 0, 0, 0, 0, 0 ]'); + inspect(SIMD.Uint16x8()), + 'Uint16x8 [ 0, 0, 0, 0, 0, 0, 0, 0 ]'); } if (typeof SIMD.Uint32x4 === 'function') { assert.strictEqual( - inspect(SIMD.Uint32x4()), - 'Uint32x4 [ 0, 0, 0, 0 ]'); + inspect(SIMD.Uint32x4()), + 'Uint32x4 [ 0, 0, 0, 0 ]'); } if (typeof SIMD.Uint8x16 === 'function') { assert.strictEqual( - inspect(SIMD.Uint8x16()), - 'Uint8x16 [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]'); + inspect(SIMD.Uint8x16()), + 'Uint8x16 [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]'); } // Tests from test-inspect.js that should not fail with --harmony_simd. diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index e3a65c895ab6d1..df35ec3a00153b 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -42,8 +42,9 @@ assert.strictEqual(util.inspect({'a': {'b': { 'c': 2}}}, false, 0), '{ a: [Object] }'); assert.strictEqual(util.inspect({'a': {'b': { 'c': 2}}}, false, 1), '{ a: { b: [Object] } }'); -assert.strictEqual(util.inspect(Object.create({}, - {visible: {value: 1, enumerable: true}, hidden: {value: 2}})), +assert.strictEqual(util.inspect( + Object.create({}, + {visible: {value: 1, enumerable: true}, hidden: {value: 2}})), '{ visible: 1 }' ); @@ -137,14 +138,14 @@ for (const showHidden of [true, false]) { Uint32Array, Uint8Array, Uint8ClampedArray ].forEach((constructor) => { - const length = 2; - const byteLength = length * constructor.BYTES_PER_ELEMENT; - const array = new constructor(new ArrayBuffer(byteLength), 0, length); - array[0] = 65; - array[1] = 97; - assert.strictEqual( - util.inspect(array, true), - `${constructor.name} [\n` + + const length = 2; + const byteLength = length * constructor.BYTES_PER_ELEMENT; + const array = new constructor(new ArrayBuffer(byteLength), 0, length); + array[0] = 65; + array[1] = 97; + assert.strictEqual( + util.inspect(array, true), + `${constructor.name} [\n` + ' 65,\n' + ' 97,\n' + ` [BYTES_PER_ELEMENT]: ${constructor.BYTES_PER_ELEMENT},\n` + @@ -152,11 +153,11 @@ for (const showHidden of [true, false]) { ` [byteLength]: ${byteLength},\n` + ' [byteOffset]: 0,\n' + ` [buffer]: ArrayBuffer { byteLength: ${byteLength} } ]`); - assert.strictEqual( - util.inspect(array, false), - `${constructor.name} [ 65, 97 ]` - ); - }); + assert.strictEqual( + util.inspect(array, false), + `${constructor.name} [ 65, 97 ]` + ); +}); // Now check that declaring a TypedArray in a different context works the same [ Float32Array, @@ -168,17 +169,17 @@ for (const showHidden of [true, false]) { Uint32Array, Uint8Array, Uint8ClampedArray ].forEach((constructor) => { - const length = 2; - const byteLength = length * constructor.BYTES_PER_ELEMENT; - const array = vm.runInNewContext( - 'new constructor(new ArrayBuffer(byteLength), 0, length)', - { constructor, byteLength, length } - ); - array[0] = 65; - array[1] = 97; - assert.strictEqual( - util.inspect(array, true), - `${constructor.name} [\n` + + const length = 2; + const byteLength = length * constructor.BYTES_PER_ELEMENT; + const array = vm.runInNewContext( + 'new constructor(new ArrayBuffer(byteLength), 0, length)', + { constructor, byteLength, length } + ); + array[0] = 65; + array[1] = 97; + assert.strictEqual( + util.inspect(array, true), + `${constructor.name} [\n` + ' 65,\n' + ' 97,\n' + ` [BYTES_PER_ELEMENT]: ${constructor.BYTES_PER_ELEMENT},\n` + @@ -186,19 +187,25 @@ for (const showHidden of [true, false]) { ` [byteLength]: ${byteLength},\n` + ' [byteOffset]: 0,\n' + ` [buffer]: ArrayBuffer { byteLength: ${byteLength} } ]`); - assert.strictEqual( - util.inspect(array, false), - `${constructor.name} [ 65, 97 ]` - ); - }); + assert.strictEqual( + util.inspect(array, false), + `${constructor.name} [ 65, 97 ]` + ); +}); // Due to the hash seed randomization it's not deterministic the order that // the following ways this hash is displayed. // See http://codereview.chromium.org/9124004/ { - const out = util.inspect(Object.create({}, - {visible: {value: 1, enumerable: true}, hidden: {value: 2}}), true); + const out = + util.inspect( + Object.create( + {}, + {visible: {value: 1, enumerable: true}, hidden: {value: 2}} + ), + true + ); if (out !== '{ [hidden]: 2, visible: 1 }' && out !== '{ visible: 1, [hidden]: 2 }') { common.fail(`unexpected value for out ${out}`); @@ -840,7 +847,7 @@ checkAlignment(new Map(big_array.map(function(y) { return [y, null]; }))); { const x = Array(101); assert(/^\[ ... 101 more items ]$/.test( - util.inspect(x, {maxArrayLength: 0}))); + util.inspect(x, {maxArrayLength: 0}))); } { @@ -856,7 +863,7 @@ checkAlignment(new Map(big_array.map(function(y) { return [y, null]; }))); { const x = new Uint8Array(101); assert(/\[ ... 101 more items ]$/.test( - util.inspect(x, {maxArrayLength: 0}))); + util.inspect(x, {maxArrayLength: 0}))); } { diff --git a/test/parallel/test-util-sigint-watchdog.js b/test/parallel/test-util-sigint-watchdog.js index 207f44b011c3a2..fdf8dc160c2ed6 100644 --- a/test/parallel/test-util-sigint-watchdog.js +++ b/test/parallel/test-util-sigint-watchdog.js @@ -17,7 +17,7 @@ if (common.isWindows) { next(); }, (next) => { - // Test with one call to the watchdog, one signal. + // Test with one call to the watchdog, one signal. binding.startSigintWatchdog(); process.kill(process.pid, 'SIGINT'); waitForPendingSignal(common.mustCall(() => { @@ -27,7 +27,7 @@ if (common.isWindows) { })); }, (next) => { - // Nested calls are okay. + // Nested calls are okay. binding.startSigintWatchdog(); binding.startSigintWatchdog(); process.kill(process.pid, 'SIGINT'); @@ -40,7 +40,7 @@ if (common.isWindows) { })); }, () => { - // Signal comes in after first call to stop. + // Signal comes in after first call to stop. binding.startSigintWatchdog(); binding.startSigintWatchdog(); const hadPendingSignals1 = binding.stopSigintWatchdog(); diff --git a/test/parallel/test-vm-sigint-existing-handler.js b/test/parallel/test-vm-sigint-existing-handler.js index cbd91bef06c950..834367a871bce0 100644 --- a/test/parallel/test-vm-sigint-existing-handler.js +++ b/test/parallel/test-vm-sigint-existing-handler.js @@ -34,8 +34,8 @@ if (process.argv[2] === 'child') { const script = `process.send('${method}'); while(true) {}`; const args = method === 'runInContext' ? - [vm.createContext({ process })] : - []; + [vm.createContext({ process })] : + []; const options = { breakOnSigint: true }; assert.throws(() => { vm[method](script, ...args, options); }, diff --git a/test/parallel/test-vm-sigint.js b/test/parallel/test-vm-sigint.js index 24ad7ab0472ab6..3fd338edf25eae 100644 --- a/test/parallel/test-vm-sigint.js +++ b/test/parallel/test-vm-sigint.js @@ -22,8 +22,8 @@ if (process.argv[2] === 'child') { const script = `process.send('${method}'); while(true) {}`; const args = method === 'runInContext' ? - [vm.createContext({ process })] : - []; + [vm.createContext({ process })] : + []; const options = { breakOnSigint: true }; assert.throws(() => { vm[method](script, ...args, options); }, diff --git a/test/parallel/test-zlib-convenience-methods.js b/test/parallel/test-zlib-convenience-methods.js index ecb556e83767f9..f27f30b305a807 100644 --- a/test/parallel/test-zlib-convenience-methods.js +++ b/test/parallel/test-zlib-convenience-methods.js @@ -24,7 +24,7 @@ const opts = { zlib[method[1]](result, opts, function(err, result) { assert.strictEqual(result.toString(), expect, `Should get original string after ${ - method[0]}/${method[1]} with options.`); + method[0]}/${method[1]} with options.`); hadRun++; }); }); @@ -33,7 +33,7 @@ const opts = { zlib[method[1]](result, function(err, result) { assert.strictEqual(result.toString(), expect, `Should get original string after ${ - method[0]}/${method[1]} without options.`); + method[0]}/${method[1]} without options.`); hadRun++; }); }); @@ -42,14 +42,14 @@ const opts = { result = zlib[`${method[1]}Sync`](result, opts); assert.strictEqual(result.toString(), expect, `Should get original string after ${ - method[0]}/${method[1]} with options.`); + method[0]}/${method[1]} with options.`); hadRun++; result = zlib[`${method[0]}Sync`](expect); result = zlib[`${method[1]}Sync`](result); assert.strictEqual(result.toString(), expect, `Should get original string after ${ - method[0]}/${method[1]} without options.`); + method[0]}/${method[1]} without options.`); hadRun++; }); diff --git a/test/parallel/test-zlib.js b/test/parallel/test-zlib.js index d2e290298fec5d..468b5f346f04ee 100644 --- a/test/parallel/test-zlib.js +++ b/test/parallel/test-zlib.js @@ -164,7 +164,7 @@ Object.keys(tests).forEach(function(file) { // verify that the same exact buffer comes out the other end. buf.on('data', function(c) { const msg = `${file} ${chunkSize} ${ - JSON.stringify(opts)} ${Def.name} -> ${Inf.name}`; + JSON.stringify(opts)} ${Def.name} -> ${Inf.name}`; let ok = true; const testNum = ++done; let i; diff --git a/test/pummel/test-dtrace-jsstack.js b/test/pummel/test-dtrace-jsstack.js index 9833324e072f93..81ffdf0039e307 100644 --- a/test/pummel/test-dtrace-jsstack.js +++ b/test/pummel/test-dtrace-jsstack.js @@ -39,7 +39,7 @@ const spawn = require('child_process').spawn; * deepest function is the only caller of os.loadavg(). */ const dtrace = spawn('dtrace', [ '-qwn', `syscall::getloadavg:entry/pid == ${ - process.pid}/{ustack(100, 8192); exit(0); }` ]); + process.pid}/{ustack(100, 8192); exit(0); }` ]); let output = ''; diff --git a/test/pummel/test-fs-watch-file.js b/test/pummel/test-fs-watch-file.js index bbccd52d843fdd..7f4ee845252e31 100644 --- a/test/pummel/test-fs-watch-file.js +++ b/test/pummel/test-fs-watch-file.js @@ -37,21 +37,21 @@ process.on('exit', function() { fs.writeFileSync(filepathOne, 'hello'); assert.throws( - function() { - fs.watchFile(filepathOne); - }, - function(e) { - return e.message === '"watchFile()" requires a listener function'; - } + function() { + fs.watchFile(filepathOne); + }, + function(e) { + return e.message === '"watchFile()" requires a listener function'; + } ); assert.doesNotThrow( - function() { - fs.watchFile(filepathOne, function() { - fs.unwatchFile(filepathOne); - ++watchSeenOne; - }); - } + function() { + fs.watchFile(filepathOne, function() { + fs.unwatchFile(filepathOne); + ++watchSeenOne; + }); + } ); setTimeout(function() { @@ -64,27 +64,27 @@ process.chdir(testDir); fs.writeFileSync(filepathTwoAbs, 'howdy'); assert.throws( - function() { - fs.watchFile(filepathTwo); - }, - function(e) { - return e.message === '"watchFile()" requires a listener function'; - } + function() { + fs.watchFile(filepathTwo); + }, + function(e) { + return e.message === '"watchFile()" requires a listener function'; + } ); assert.doesNotThrow( - function() { - function a() { - fs.unwatchFile(filepathTwo, a); - ++watchSeenTwo; - } - function b() { - fs.unwatchFile(filepathTwo, b); - ++watchSeenTwo; - } - fs.watchFile(filepathTwo, a); - fs.watchFile(filepathTwo, b); + function() { + function a() { + fs.unwatchFile(filepathTwo, a); + ++watchSeenTwo; + } + function b() { + fs.unwatchFile(filepathTwo, b); + ++watchSeenTwo; } + fs.watchFile(filepathTwo, a); + fs.watchFile(filepathTwo, b); + } ); setTimeout(function() { @@ -92,18 +92,15 @@ setTimeout(function() { }, 1000); assert.doesNotThrow( - function() { - function a() { - assert.ok(0); // should not run - } - function b() { - fs.unwatchFile(filenameThree, b); - ++watchSeenThree; - } - fs.watchFile(filenameThree, a); - fs.watchFile(filenameThree, b); - fs.unwatchFile(filenameThree, a); + function() { + function b() { + fs.unwatchFile(filenameThree, b); + ++watchSeenThree; } + fs.watchFile(filenameThree, common.mustNotCall()); + fs.watchFile(filenameThree, b); + fs.unwatchFile(filenameThree, common.mustNotCall()); + } ); setTimeout(function() { @@ -119,12 +116,12 @@ setTimeout(function() { }, 500); assert.doesNotThrow( - function() { - function a() { - ++watchSeenFour; - assert.strictEqual(1, watchSeenFour); - fs.unwatchFile(`.${path.sep}${filenameFour}`, a); - } - fs.watchFile(filenameFour, a); + function() { + function a() { + ++watchSeenFour; + assert.strictEqual(1, watchSeenFour); + fs.unwatchFile(`.${path.sep}${filenameFour}`, a); } + fs.watchFile(filenameFour, a); + } ); diff --git a/test/pummel/test-hash-seed.js b/test/pummel/test-hash-seed.js index c357a3964946c7..05d29fff0b8b90 100644 --- a/test/pummel/test-hash-seed.js +++ b/test/pummel/test-hash-seed.js @@ -11,7 +11,7 @@ const seeds = []; for (let i = 0; i < REPETITIONS; ++i) { const seed = cp.spawnSync(process.execPath, [targetScript], - { encoding: 'utf8' }).stdout.trim(); + { encoding: 'utf8' }).stdout.trim(); seeds.push(seed); } diff --git a/test/sequential/test-dgram-bind-shared-ports.js b/test/sequential/test-dgram-bind-shared-ports.js index 7e4f4e850aafbb..b8f930da3c5da1 100644 --- a/test/sequential/test-dgram-bind-shared-ports.js +++ b/test/sequential/test-dgram-bind-shared-ports.js @@ -62,19 +62,19 @@ if (cluster.isMaster) { // First worker should bind, second should err const socket3OnBind = isSecondWorker ? - common.mustNotCall() : - common.mustCall(() => { - const port3 = socket3.address().port; - assert.strictEqual(typeof port3, 'number'); - process.send('success'); - }); + common.mustNotCall() : + common.mustCall(() => { + const port3 = socket3.address().port; + assert.strictEqual(typeof port3, 'number'); + process.send('success'); + }); // an error is expected only in the second worker const socket3OnError = !isSecondWorker ? - common.mustNotCall() : - common.mustCall((err) => { - process.send(`socket3:${err.code}`); - }); + common.mustNotCall() : + common.mustCall((err) => { + process.send(`socket3:${err.code}`); + }); const address = common.localhostIPv4; const opt1 = { address, port: 0, exclusive: false }; const opt2 = { address, port: common.PORT, exclusive: false }; diff --git a/test/sequential/test-domain-abort-on-uncaught.js b/test/sequential/test-domain-abort-on-uncaught.js index dfac371afcddff..a09db889bfad0e 100644 --- a/test/sequential/test-domain-abort-on-uncaught.js +++ b/test/sequential/test-domain-abort-on-uncaught.js @@ -248,7 +248,7 @@ if (process.argv[2] === 'child') { assert.strictEqual( code, 0, `Test at index ${testIndex } should have exited with exit code 0 but instead exited with code ${ - code} and signal ${signal}`); + code} and signal ${signal}`); }); }); } diff --git a/test/sequential/test-fs-watch.js b/test/sequential/test-fs-watch.js index 70c165ea7992be..115dde39097faf 100644 --- a/test/sequential/test-fs-watch.js +++ b/test/sequential/test-fs-watch.js @@ -54,18 +54,18 @@ common.refreshTmpDir(); fs.writeFileSync(filepathOne, 'hello'); assert.doesNotThrow( - function() { - const watcher = fs.watch(filepathOne); - watcher.on('change', function(event, filename) { - assert.strictEqual(event, 'change'); - - if (expectFilePath) { - assert.strictEqual(filename, 'watch.txt'); - } - watcher.close(); - ++watchSeenOne; - }); - } + function() { + const watcher = fs.watch(filepathOne); + watcher.on('change', function(event, filename) { + assert.strictEqual(event, 'change'); + + if (expectFilePath) { + assert.strictEqual(filename, 'watch.txt'); + } + watcher.close(); + ++watchSeenOne; + }); + } ); setImmediate(function() { @@ -78,17 +78,17 @@ process.chdir(testDir); fs.writeFileSync(filepathTwoAbs, 'howdy'); assert.doesNotThrow( - function() { - const watcher = fs.watch(filepathTwo, function(event, filename) { - assert.strictEqual(event, 'change'); - - if (expectFilePath) { - assert.strictEqual(filename, 'hasOwnProperty'); - } - watcher.close(); - ++watchSeenTwo; - }); - } + function() { + const watcher = fs.watch(filepathTwo, function(event, filename) { + assert.strictEqual(event, 'change'); + + if (expectFilePath) { + assert.strictEqual(filename, 'hasOwnProperty'); + } + watcher.close(); + ++watchSeenTwo; + }); + } ); setImmediate(function() { @@ -100,19 +100,19 @@ const testsubdir = fs.mkdtempSync(testDir + path.sep); const filepathThree = path.join(testsubdir, filenameThree); assert.doesNotThrow( - function() { - const watcher = fs.watch(testsubdir, function(event, filename) { - const renameEv = common.isSunOS || common.isAix ? 'change' : 'rename'; - assert.strictEqual(event, renameEv); - if (expectFilePath) { - assert.strictEqual(filename, 'newfile.txt'); - } else { - assert.strictEqual(filename, null); - } - watcher.close(); - ++watchSeenThree; - }); - } + function() { + const watcher = fs.watch(testsubdir, function(event, filename) { + const renameEv = common.isSunOS || common.isAix ? 'change' : 'rename'; + assert.strictEqual(event, renameEv); + if (expectFilePath) { + assert.strictEqual(filename, 'newfile.txt'); + } else { + assert.strictEqual(filename, null); + } + watcher.close(); + ++watchSeenThree; + }); + } ); setImmediate(function() { diff --git a/test/sequential/test-regress-GH-877.js b/test/sequential/test-regress-GH-877.js index 7cba74cb53ec9a..e65ec25711529d 100644 --- a/test/sequential/test-regress-GH-877.js +++ b/test/sequential/test-regress-GH-877.js @@ -35,11 +35,11 @@ server.listen(common.PORT, '127.0.0.1', function() { console.log( `Socket: ${agent.sockets[addrString].length}/${ - agent.maxSockets} queued: ${ - agent.requests[addrString] ? agent.requests[addrString].length : 0}`); + agent.maxSockets} queued: ${ + agent.requests[addrString] ? agent.requests[addrString].length : 0}`); const agentRequests = agent.requests[addrString] ? - agent.requests[addrString].length : 0; + agent.requests[addrString].length : 0; if (maxQueued < agentRequests) { maxQueued = agentRequests; diff --git a/test/timers/test-timers-reliability.js b/test/timers/test-timers-reliability.js index 9a9834aefecc7f..96986a74a6313c 100644 --- a/test/timers/test-timers-reliability.js +++ b/test/timers/test-timers-reliability.js @@ -33,7 +33,7 @@ let intervalFired = false; const monoTimer = new Timer(); monoTimer[Timer.kOnTimeout] = function() { - /* + /* * Make sure that setTimeout's and setInterval's callbacks have * already fired, otherwise it means that they are vulnerable to * time drifting or inconsistent time changes.