diff --git a/benchmark/_test-double-benchmarker.js b/benchmark/_test-double-benchmarker.js index a95ad9c861..0a8c5f9264 100644 --- a/benchmark/_test-double-benchmarker.js +++ b/benchmark/_test-double-benchmarker.js @@ -3,5 +3,5 @@ const http = require('http'); http.get(process.env.path, function() { - console.log(JSON.stringify({throughput: 1})); + console.log(JSON.stringify({ throughput: 1 })); }); diff --git a/benchmark/crypto/aes-gcm-throughput.js b/benchmark/crypto/aes-gcm-throughput.js index 0cb3268951..8264f53547 100644 --- a/benchmark/crypto/aes-gcm-throughput.js +++ b/benchmark/crypto/aes-gcm-throughput.js @@ -1,7 +1,7 @@ 'use strict'; var common = require('../common.js'); var crypto = require('crypto'); -var keylen = {'aes-128-gcm': 16, 'aes-192-gcm': 24, 'aes-256-gcm': 32}; +var keylen = { 'aes-128-gcm': 16, 'aes-192-gcm': 24, 'aes-256-gcm': 32 }; var bench = common.createBenchmark(main, { n: [500], cipher: ['aes-128-gcm', 'aes-192-gcm', 'aes-256-gcm'], diff --git a/benchmark/events/ee-add-remove.js b/benchmark/events/ee-add-remove.js index 1140a81649..bc53cc7270 100644 --- a/benchmark/events/ee-add-remove.js +++ b/benchmark/events/ee-add-remove.js @@ -2,7 +2,7 @@ var common = require('../common.js'); var events = require('events'); -var bench = common.createBenchmark(main, {n: [25e4]}); +var bench = common.createBenchmark(main, { n: [25e4] }); function main(conf) { var n = conf.n | 0; diff --git a/benchmark/events/ee-emit-multi-args.js b/benchmark/events/ee-emit-multi-args.js index b423c216b1..8c05b15962 100644 --- a/benchmark/events/ee-emit-multi-args.js +++ b/benchmark/events/ee-emit-multi-args.js @@ -2,7 +2,7 @@ var common = require('../common.js'); var EventEmitter = require('events').EventEmitter; -var bench = common.createBenchmark(main, {n: [2e6]}); +var bench = common.createBenchmark(main, { n: [2e6] }); function main(conf) { var n = conf.n | 0; diff --git a/benchmark/events/ee-emit.js b/benchmark/events/ee-emit.js index 87772222f0..fdd4978a1a 100644 --- a/benchmark/events/ee-emit.js +++ b/benchmark/events/ee-emit.js @@ -2,7 +2,7 @@ var common = require('../common.js'); var EventEmitter = require('events').EventEmitter; -var bench = common.createBenchmark(main, {n: [2e6]}); +var bench = common.createBenchmark(main, { n: [2e6] }); function main(conf) { var n = conf.n | 0; diff --git a/benchmark/events/ee-listener-count-on-prototype.js b/benchmark/events/ee-listener-count-on-prototype.js index 269fd5a493..4075648355 100644 --- a/benchmark/events/ee-listener-count-on-prototype.js +++ b/benchmark/events/ee-listener-count-on-prototype.js @@ -2,7 +2,7 @@ var common = require('../common.js'); var EventEmitter = require('events').EventEmitter; -var bench = common.createBenchmark(main, {n: [5e7]}); +var bench = common.createBenchmark(main, { n: [5e7] }); function main(conf) { var n = conf.n | 0; diff --git a/benchmark/events/ee-listeners-many.js b/benchmark/events/ee-listeners-many.js index 09e533de32..fd04be127b 100644 --- a/benchmark/events/ee-listeners-many.js +++ b/benchmark/events/ee-listeners-many.js @@ -2,7 +2,7 @@ var common = require('../common.js'); var EventEmitter = require('events').EventEmitter; -var bench = common.createBenchmark(main, {n: [5e6]}); +var bench = common.createBenchmark(main, { n: [5e6] }); function main(conf) { var n = conf.n | 0; diff --git a/benchmark/events/ee-listeners.js b/benchmark/events/ee-listeners.js index 56c0e85dad..36bda66a4e 100644 --- a/benchmark/events/ee-listeners.js +++ b/benchmark/events/ee-listeners.js @@ -2,7 +2,7 @@ var common = require('../common.js'); var EventEmitter = require('events').EventEmitter; -var bench = common.createBenchmark(main, {n: [5e6]}); +var bench = common.createBenchmark(main, { n: [5e6] }); function main(conf) { var n = conf.n | 0; diff --git a/benchmark/events/ee-once.js b/benchmark/events/ee-once.js index 56f7fb9e7c..5be5dc9837 100644 --- a/benchmark/events/ee-once.js +++ b/benchmark/events/ee-once.js @@ -2,7 +2,7 @@ var common = require('../common.js'); var EventEmitter = require('events').EventEmitter; -var bench = common.createBenchmark(main, {n: [2e7]}); +var bench = common.createBenchmark(main, { n: [2e7] }); function main(conf) { var n = conf.n | 0; diff --git a/benchmark/url/url-format.js b/benchmark/url/url-format.js index 771786d335..dc8e020879 100644 --- a/benchmark/url/url-format.js +++ b/benchmark/url/url-format.js @@ -3,8 +3,8 @@ const common = require('../common.js'); const url = require('url'); const inputs = { - slashes: {slashes: true, host: 'localhost'}, - file: {protocol: 'file:', pathname: '/foo'}, + slashes: { slashes: true, host: 'localhost' }, + file: { protocol: 'file:', pathname: '/foo' }, }; const bench = common.createBenchmark(main, { diff --git a/benchmark/util/format.js b/benchmark/util/format.js index 82e25b4c4c..55ce76e1db 100644 --- a/benchmark/util/format.js +++ b/benchmark/util/format.js @@ -17,7 +17,7 @@ const bench = common.createBenchmark(main, { const inputs = { 'string': ['Hello, my name is %s', 'fred'], 'number': ['Hi, I was born in %d', 1942], - 'object': ['An error occurred %j', {msg: 'This is an error', code: 'ERR'}], + 'object': ['An error occurred %j', { msg: 'This is an error', code: 'ERR' }], 'unknown': ['hello %a', 'test'], 'no-replace': [1, 2] }; diff --git a/benchmark/util/inspect-proxy.js b/benchmark/util/inspect-proxy.js index 805c520e28..c220462ce7 100644 --- a/benchmark/util/inspect-proxy.js +++ b/benchmark/util/inspect-proxy.js @@ -10,20 +10,20 @@ const bench = common.createBenchmark(main, { function twoDifferentProxies(n) { // This one should be slower because we're looking up multiple proxies. - const proxyA = new Proxy({}, {get: () => {}}); - const proxyB = new Proxy({}, {get: () => {}}); + const proxyA = new Proxy({}, { get: () => {} }); + const proxyB = new Proxy({}, { get: () => {} }); bench.start(); for (var i = 0; i < n; i += 1) - util.inspect({a: proxyA, b: proxyB}, {showProxy: true}); + util.inspect({ a: proxyA, b: proxyB }, { showProxy: true }); bench.end(n); } function oneProxy(n) { // This one should be a bit faster because of the internal caching. - const proxy = new Proxy({}, {get: () => {}}); + const proxy = new Proxy({}, { get: () => {} }); bench.start(); for (var i = 0; i < n; i += 1) - util.inspect({a: proxy, b: proxy}, {showProxy: true}); + util.inspect({ a: proxy, b: proxy }, { showProxy: true }); bench.end(n); } diff --git a/benchmark/util/inspect.js b/benchmark/util/inspect.js index 3312bd683b..115a3b64a7 100644 --- a/benchmark/util/inspect.js +++ b/benchmark/util/inspect.js @@ -3,14 +3,14 @@ var util = require('util'); var common = require('../common.js'); -var bench = common.createBenchmark(main, {n: [5e6]}); +var bench = common.createBenchmark(main, { n: [5e6] }); function main(conf) { var n = conf.n | 0; bench.start(); for (var i = 0; i < n; i += 1) { - util.inspect({a: 'a', b: 'b', c: 'c', d: 'd'}); + util.inspect({ a: 'a', b: 'b', c: 'c', d: 'd' }); } bench.end(n); } diff --git a/benchmark/vm/run-in-context.js b/benchmark/vm/run-in-context.js index d1d4b5a7ab..6e26a6d0eb 100644 --- a/benchmark/vm/run-in-context.js +++ b/benchmark/vm/run-in-context.js @@ -12,7 +12,7 @@ const vm = require('vm'); function main(conf) { const n = +conf.n; - const options = conf.breakOnSigint ? {breakOnSigint: true} : {}; + const options = conf.breakOnSigint ? { breakOnSigint: true } : {}; const withSigintListener = !!conf.withSigintListener; process.removeAllListeners('SIGINT'); diff --git a/benchmark/vm/run-in-this-context.js b/benchmark/vm/run-in-this-context.js index f3a7e96928..a0c737f469 100644 --- a/benchmark/vm/run-in-this-context.js +++ b/benchmark/vm/run-in-this-context.js @@ -12,7 +12,7 @@ const vm = require('vm'); function main(conf) { const n = +conf.n; - const options = conf.breakOnSigint ? {breakOnSigint: true} : {}; + const options = conf.breakOnSigint ? { breakOnSigint: true } : {}; const withSigintListener = !!conf.withSigintListener; process.removeAllListeners('SIGINT'); diff --git a/lib/console.js b/lib/console.js index 6358a3e19d..4b76bac880 100644 --- a/lib/console.js +++ b/lib/console.js @@ -124,7 +124,7 @@ Console.prototype.error = Console.prototype.warn; Console.prototype.dir = function dir(object, options) { - options = Object.assign({customInspect: false}, options); + options = Object.assign({ customInspect: false }, options); write(this._ignoreErrors, this._stdout, `${util.inspect(object, options)}\n`, diff --git a/lib/dgram.js b/lib/dgram.js index 0b2d9e5ebd..178ece8738 100644 --- a/lib/dgram.js +++ b/lib/dgram.js @@ -408,7 +408,7 @@ Socket.prototype.send = function(buffer, this._healthCheck(); if (this._bindState === BIND_STATE_UNBOUND) - this.bind({port: 0, exclusive: true}, null); + this.bind({ port: 0, exclusive: true }, null); if (list.length === 0) list.push(Buffer.alloc(0)); diff --git a/lib/dns.js b/lib/dns.js index 8f84a07950..877dc6218a 100644 --- a/lib/dns.js +++ b/lib/dns.js @@ -164,7 +164,7 @@ function lookup(hostname, options, callback) { if (matchedFamily) { if (all) { process.nextTick( - callback, null, [{address: hostname, family: matchedFamily}]); + callback, null, [{ address: hostname, family: matchedFamily }]); } else { process.nextTick(callback, null, hostname, matchedFamily); } diff --git a/lib/fs.js b/lib/fs.js index a5403d50f9..d733a0eaa5 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -253,10 +253,10 @@ function statsFromValues() { // Don't allow mode to accidentally be overwritten. Object.defineProperties(fs, { - F_OK: {enumerable: true, value: constants.F_OK || 0}, - R_OK: {enumerable: true, value: constants.R_OK || 0}, - W_OK: {enumerable: true, value: constants.W_OK || 0}, - X_OK: {enumerable: true, value: constants.X_OK || 0}, + F_OK: { enumerable: true, value: constants.F_OK || 0 }, + R_OK: { enumerable: true, value: constants.R_OK || 0 }, + W_OK: { enumerable: true, value: constants.W_OK || 0 }, + X_OK: { enumerable: true, value: constants.X_OK || 0 }, }); function handleError(val, callback) { diff --git a/lib/inspector.js b/lib/inspector.js index 6a80c36d52..a7de5478f2 100644 --- a/lib/inspector.js +++ b/lib/inspector.js @@ -62,7 +62,7 @@ class Session extends EventEmitter { throw new Error('Session is not connected'); } const id = this[nextIdSymbol]++; - const message = {id, method}; + const message = { id, method }; if (params) { message['params'] = params; } diff --git a/lib/internal/bootstrap_node.js b/lib/internal/bootstrap_node.js index 0c82e5e36d..feb6b3e366 100644 --- a/lib/internal/bootstrap_node.js +++ b/lib/internal/bootstrap_node.js @@ -454,7 +454,7 @@ // wrap it source = Module.wrap(source); // compile the script, this will throw if it fails - new vm.Script(source, {displayErrors: true, filename}); + new vm.Script(source, { displayErrors: true, filename }); } // Below you find a minimal module system, which is used to load the node diff --git a/lib/internal/child_process.js b/lib/internal/child_process.js index 216a2fb85a..b88f5423ac 100644 --- a/lib/internal/child_process.js +++ b/lib/internal/child_process.js @@ -110,7 +110,7 @@ const handleConversion = { }, got: function(message, handle, emit) { - var socket = new net.Socket({handle: handle}); + var socket = new net.Socket({ handle: handle }); socket.readable = socket.writable = true; // if the socket was created by net.Server we will track the socket @@ -584,7 +584,7 @@ function setupChannel(target, channel) { options); } - options = Object.assign({swallowErrors: false}, options); + options = Object.assign({ swallowErrors: false }, options); if (this.connected) { return this._send(message, handle, options, callback); @@ -606,7 +606,7 @@ function setupChannel(target, channel) { // Support legacy function signature if (typeof options === 'boolean') { - options = {swallowErrors: options}; + options = { swallowErrors: options }; } // package messages with a handle object @@ -840,7 +840,7 @@ function _validateStdio(stdio, sync) { } if (stdio === 'ignore') { - acc.push({type: 'ignore'}); + acc.push({ type: 'ignore' }); } else if (stdio === 'pipe' || typeof stdio === 'number' && stdio < 0) { var a = { type: 'pipe', diff --git a/lib/internal/cluster/master.js b/lib/internal/cluster/master.js index 05663e792b..4ccf039322 100644 --- a/lib/internal/cluster/master.js +++ b/lib/internal/cluster/master.js @@ -12,7 +12,7 @@ const cluster = new EventEmitter(); const intercom = new EventEmitter(); const SCHED_NONE = 1; const SCHED_RR = 2; -const {isLegalPort} = require('internal/net'); +const { isLegalPort } = require('internal/net'); module.exports = cluster; diff --git a/lib/internal/socket_list.js b/lib/internal/socket_list.js index f6091c0c66..8aa12d45d4 100644 --- a/lib/internal/socket_list.js +++ b/lib/internal/socket_list.js @@ -104,4 +104,4 @@ class SocketListReceive extends EventEmitter { } } -module.exports = {SocketListSend, SocketListReceive}; +module.exports = { SocketListSend, SocketListReceive }; diff --git a/lib/internal/util.js b/lib/internal/util.js index 1eacb95f2c..735f78d4ac 100644 --- a/lib/internal/util.js +++ b/lib/internal/util.js @@ -150,8 +150,8 @@ function createClassWrapper(type) { } // Mask the wrapper function name and length values Object.defineProperties(fn, { - name: {value: type.name}, - length: {value: type.length} + name: { value: type.name }, + length: { value: type.length } }); Object.setPrototypeOf(fn, type); fn.prototype = type.prototype; diff --git a/lib/readline.js b/lib/readline.js index b757247e34..a022a1991c 100644 --- a/lib/readline.js +++ b/lib/readline.js @@ -692,7 +692,7 @@ Interface.prototype._getDisplayPos = function(str) { } var cols = offset % col; var rows = row + (offset - cols) / col; - return {cols: cols, rows: rows}; + return { cols: cols, rows: rows }; }; @@ -711,7 +711,7 @@ Interface.prototype._getCursorPos = function() { rows++; cols = 0; } - return {cols: cols, rows: rows}; + return { cols: cols, rows: rows }; }; diff --git a/lib/repl.js b/lib/repl.js index 0b621ac4a2..79abb35ce2 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -1055,7 +1055,7 @@ REPLServer.prototype.parseREPLKeyword = function(keyword, rest) { REPLServer.prototype.defineCommand = function(keyword, cmd) { if (typeof cmd === 'function') { - cmd = {action: cmd}; + cmd = { action: cmd }; } else if (typeof cmd.action !== 'function') { throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'action', 'function', cmd.action); diff --git a/test/addons-napi/test_make_callback_recurse/test.js b/test/addons-napi/test_make_callback_recurse/test.js index 895769bc33..77815e052a 100644 --- a/test/addons-napi/test_make_callback_recurse/test.js +++ b/test/addons-napi/test_make_callback_recurse/test.js @@ -101,11 +101,11 @@ function checkDomains() { const d2 = domain.create(); const d3 = domain.create(); - makeCallback({domain: d1}, common.mustCall(function() { + makeCallback({ domain: d1 }, common.mustCall(function() { assert.strictEqual(d1, process.domain); - makeCallback({domain: d2}, common.mustCall(function() { + makeCallback({ domain: d2 }, common.mustCall(function() { assert.strictEqual(d2, process.domain); - makeCallback({domain: d3}, common.mustCall(function() { + makeCallback({ domain: d3 }, common.mustCall(function() { assert.strictEqual(d3, process.domain); })); assert.strictEqual(d2, process.domain); @@ -119,11 +119,11 @@ function checkDomains() { const d2 = domain.create(); const d3 = domain.create(); - makeCallback({domain: d1}, common.mustCall(function() { + makeCallback({ domain: d1 }, common.mustCall(function() { assert.strictEqual(d1, process.domain); - makeCallback({domain: d2}, common.mustCall(function() { + makeCallback({ domain: d2 }, common.mustCall(function() { assert.strictEqual(d2, process.domain); - makeCallback({domain: d3}, common.mustCall(function() { + makeCallback({ domain: d3 }, common.mustCall(function() { assert.strictEqual(d3, process.domain); })); assert.strictEqual(d2, process.domain); @@ -139,7 +139,7 @@ function checkDomains() { d.on('error', common.mustCall(function(e) { assert.strictEqual(e.message, `throw from domain ${id}`); })); - makeCallback({domain: d}, function() { + makeCallback({ domain: d }, function() { throw new Error(`throw from domain ${id}`); }); throw new Error('UNREACHABLE'); diff --git a/test/addons-napi/test_object/test.js b/test/addons-napi/test_object/test.js index 9e8f17de28..8e44a1b5ed 100644 --- a/test/addons-napi/test_object/test.js +++ b/test/addons-napi/test_object/test.js @@ -92,12 +92,12 @@ assert.strictEqual(newObject.test_string, 'test string'); z: 10 }; - assert.deepStrictEqual(test_object.Inflate(cube), {x: 11, y: 11, z: 11}); - assert.deepStrictEqual(test_object.Inflate(cube), {x: 12, y: 12, z: 12}); - assert.deepStrictEqual(test_object.Inflate(cube), {x: 13, y: 13, z: 13}); + assert.deepStrictEqual(test_object.Inflate(cube), { x: 11, y: 11, z: 11 }); + assert.deepStrictEqual(test_object.Inflate(cube), { x: 12, y: 12, z: 12 }); + assert.deepStrictEqual(test_object.Inflate(cube), { x: 13, y: 13, z: 13 }); cube.t = 13; assert.deepStrictEqual( - test_object.Inflate(cube), {x: 14, y: 14, z: 14, t: 14}); + test_object.Inflate(cube), { x: 14, y: 14, z: 14, t: 14 }); const sym1 = Symbol('1'); const sym2 = Symbol('2'); diff --git a/test/addons/make-callback-recurse/test.js b/test/addons/make-callback-recurse/test.js index 895769bc33..77815e052a 100644 --- a/test/addons/make-callback-recurse/test.js +++ b/test/addons/make-callback-recurse/test.js @@ -101,11 +101,11 @@ function checkDomains() { const d2 = domain.create(); const d3 = domain.create(); - makeCallback({domain: d1}, common.mustCall(function() { + makeCallback({ domain: d1 }, common.mustCall(function() { assert.strictEqual(d1, process.domain); - makeCallback({domain: d2}, common.mustCall(function() { + makeCallback({ domain: d2 }, common.mustCall(function() { assert.strictEqual(d2, process.domain); - makeCallback({domain: d3}, common.mustCall(function() { + makeCallback({ domain: d3 }, common.mustCall(function() { assert.strictEqual(d3, process.domain); })); assert.strictEqual(d2, process.domain); @@ -119,11 +119,11 @@ function checkDomains() { const d2 = domain.create(); const d3 = domain.create(); - makeCallback({domain: d1}, common.mustCall(function() { + makeCallback({ domain: d1 }, common.mustCall(function() { assert.strictEqual(d1, process.domain); - makeCallback({domain: d2}, common.mustCall(function() { + makeCallback({ domain: d2 }, common.mustCall(function() { assert.strictEqual(d2, process.domain); - makeCallback({domain: d3}, common.mustCall(function() { + makeCallback({ domain: d3 }, common.mustCall(function() { assert.strictEqual(d3, process.domain); })); assert.strictEqual(d2, process.domain); @@ -139,7 +139,7 @@ function checkDomains() { d.on('error', common.mustCall(function(e) { assert.strictEqual(e.message, `throw from domain ${id}`); })); - makeCallback({domain: d}, function() { + makeCallback({ domain: d }, function() { throw new Error(`throw from domain ${id}`); }); throw new Error('UNREACHABLE'); diff --git a/test/async-hooks/test-promise.promise-before-init-hooks.js b/test/async-hooks/test-promise.promise-before-init-hooks.js index 27536b727d..79bbd1751d 100644 --- a/test/async-hooks/test-promise.promise-before-init-hooks.js +++ b/test/async-hooks/test-promise.promise-before-init-hooks.js @@ -10,7 +10,7 @@ const p = new Promise(common.mustCall(function executor(resolve, reject) { })); // init hooks after promise was created -const hooks = initHooks({allowNoInit: true}); +const hooks = initHooks({ allowNoInit: true }); hooks.enable(); p.then(function afterresolution(val) { diff --git a/test/common/index.js b/test/common/index.js index 0537cd784e..fc14cdacac 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -219,7 +219,7 @@ Object.defineProperty(exports, 'localhostIPv4', { }); // opensslCli defined lazily to reduce overhead of spawnSync -Object.defineProperty(exports, 'opensslCli', {get: function() { +Object.defineProperty(exports, 'opensslCli', { get: function() { if (opensslCli !== null) return opensslCli; if (process.config.variables.node_shared_openssl) { @@ -238,7 +238,7 @@ Object.defineProperty(exports, 'opensslCli', {get: function() { opensslCli = false; } return opensslCli; -}, enumerable: true}); +}, enumerable: true }); Object.defineProperty(exports, 'hasCrypto', { get: function() { diff --git a/test/debugger/helper-debugger-repl.js b/test/debugger/helper-debugger-repl.js index f11d4d9498..365b29e50d 100644 --- a/test/debugger/helper-debugger-repl.js +++ b/test/debugger/helper-debugger-repl.js @@ -125,7 +125,7 @@ function addTest(input, output) { quit(); } } - expected.push({input: input, lines: output, callback: next}); + expected.push({ input: input, lines: output, callback: next }); } const handshakeLines = [ diff --git a/test/gc/test-http-client-onerror.js b/test/gc/test-http-client-onerror.js index 0baa310a04..8b05e94174 100644 --- a/test/gc/test-http-client-onerror.js +++ b/test/gc/test-http-client-onerror.js @@ -6,7 +6,7 @@ const common = require('../common'); function serverHandler(req, res) { req.resume(); - res.writeHead(200, {'Content-Type': 'text/plain'}); + res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end('Hello World\n'); } diff --git a/test/gc/test-http-client.js b/test/gc/test-http-client.js index 569dc57491..8b50ad5ea4 100644 --- a/test/gc/test-http-client.js +++ b/test/gc/test-http-client.js @@ -4,7 +4,7 @@ const common = require('../common'); function serverHandler(req, res) { - res.writeHead(200, {'Content-Type': 'text/plain'}); + res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end('Hello World\n'); } diff --git a/test/inspector/inspector-helper.js b/test/inspector/inspector-helper.js index bc60974364..e6964b0fa2 100644 --- a/test/inspector/inspector-helper.js +++ b/test/inspector/inspector-helper.js @@ -90,7 +90,7 @@ function tearDown(child, err) { } function checkHttpResponse(host, port, path, callback, errorcb) { - const req = http.get({host, port, path}, function(res) { + const req = http.get({ host, port, path }, function(res) { let response = ''; res.setEncoding('utf8'); res @@ -377,7 +377,7 @@ function Harness(port, childProcess) { this.stderrFilters_ = pending; })); childProcess.on('exit', (code, signal) => { - this.result_ = {code, signal}; + this.result_ = { code, signal }; this.running_ = false; }); } @@ -483,7 +483,7 @@ Harness.prototype.expectShutDown = function(errorCode) { const timeoutId = timeout('Have not terminated'); this.process_.on('exit', (code, signal) => { clearTimeout(timeoutId); - assert.strictEqual(errorCode, code, JSON.stringify({code, signal})); + assert.strictEqual(errorCode, code, JSON.stringify({ code, signal })); callback(); }); } else { diff --git a/test/inspector/test-inspector-break-when-eval.js b/test/inspector/test-inspector-break-when-eval.js index 388edf6f5c..957d7ea4d2 100644 --- a/test/inspector/test-inspector-break-when-eval.js +++ b/test/inspector/test-inspector-break-when-eval.js @@ -59,7 +59,7 @@ function setupDebugger(session) { { 'method': 'Runtime.enable' }, { 'method': 'Debugger.enable' }, { 'method': 'Debugger.setAsyncCallStackDepth', - 'params': {'maxDepth': 0} }, + 'params': { 'maxDepth': 0 } }, { 'method': 'Runtime.runIfWaitingForDebugger' }, ]; @@ -106,7 +106,7 @@ function stepOverConsoleStatement(session) { function testWaitsForFrontendDisconnect(session, harness) { console.log('[test]', 'Verify node waits for the frontend to disconnect'); - session.sendInspectorCommands({ 'method': 'Debugger.resume'}) + session.sendInspectorCommands({ 'method': 'Debugger.resume' }) .expectMessages(setupExpectContextDestroyed(1)) .expectStderrOutput('Waiting for the debugger to disconnect...') .disconnect(true); diff --git a/test/inspector/test-inspector-debug-brk.js b/test/inspector/test-inspector-debug-brk.js index 27c9c5fdbc..1d7af9e318 100644 --- a/test/inspector/test-inspector-debug-brk.js +++ b/test/inspector/test-inspector-debug-brk.js @@ -25,14 +25,14 @@ function testBreakpointOnStart(session) { { 'method': 'Runtime.enable' }, { 'method': 'Debugger.enable' }, { 'method': 'Debugger.setPauseOnExceptions', - 'params': {'state': 'none'} }, + 'params': { 'state': 'none' } }, { 'method': 'Debugger.setAsyncCallStackDepth', - 'params': {'maxDepth': 0} }, + 'params': { 'maxDepth': 0 } }, { 'method': 'Profiler.enable' }, { 'method': 'Profiler.setSamplingInterval', - 'params': {'interval': 100} }, + 'params': { 'interval': 100 } }, { 'method': 'Debugger.setBlackboxPatterns', - 'params': {'patterns': []} }, + 'params': { 'patterns': [] } }, { 'method': 'Runtime.runIfWaitingForDebugger' } ]; @@ -43,7 +43,7 @@ function testBreakpointOnStart(session) { function testWaitsForFrontendDisconnect(session, harness) { console.log('[test]', 'Verify node waits for the frontend to disconnect'); - session.sendInspectorCommands({ 'method': 'Debugger.resume'}) + session.sendInspectorCommands({ 'method': 'Debugger.resume' }) .expectStderrOutput('Waiting for the debugger to disconnect...') .disconnect(true); } diff --git a/test/inspector/test-inspector-exception.js b/test/inspector/test-inspector-exception.js index 3f470c94c1..2c6432c65d 100644 --- a/test/inspector/test-inspector-exception.js +++ b/test/inspector/test-inspector-exception.js @@ -27,14 +27,14 @@ function testBreakpointOnStart(session) { { 'method': 'Runtime.enable' }, { 'method': 'Debugger.enable' }, { 'method': 'Debugger.setPauseOnExceptions', - 'params': {'state': 'none'} }, + 'params': { 'state': 'none' } }, { 'method': 'Debugger.setAsyncCallStackDepth', - 'params': {'maxDepth': 0} }, + 'params': { 'maxDepth': 0 } }, { 'method': 'Profiler.enable' }, { 'method': 'Profiler.setSamplingInterval', - 'params': {'interval': 100} }, + 'params': { 'interval': 100 } }, { 'method': 'Debugger.setBlackboxPatterns', - 'params': {'patterns': []} }, + 'params': { 'patterns': [] } }, { 'method': 'Runtime.runIfWaitingForDebugger' } ]; @@ -45,7 +45,7 @@ function testBreakpointOnStart(session) { function testWaitsForFrontendDisconnect(session, harness) { console.log('[test]', 'Verify node waits for the frontend to disconnect'); - session.sendInspectorCommands({ 'method': 'Debugger.resume'}) + session.sendInspectorCommands({ 'method': 'Debugger.resume' }) .expectStderrOutput('Waiting for the debugger to disconnect...') .disconnect(true); } diff --git a/test/inspector/test-inspector-port-cluster.js b/test/inspector/test-inspector-port-cluster.js index 166f5a8d10..3b2464d812 100644 --- a/test/inspector/test-inspector-port-cluster.js +++ b/test/inspector/test-inspector-port-cluster.js @@ -20,7 +20,7 @@ let offset = 0; function testRunnerMain() { let defaultPortCase = spawnMaster({ execArgv: ['--inspect'], - workers: [{expectedPort: 9230}] + workers: [{ expectedPort: 9230 }] }); let port = debuggerPort + offset++ * 5; @@ -28,9 +28,9 @@ function testRunnerMain() { spawnMaster({ execArgv: [`--inspect=${port}`], workers: [ - {expectedPort: port + 1}, - {expectedPort: port + 2}, - {expectedPort: port + 3} + { expectedPort: port + 1 }, + { expectedPort: port + 2 }, + { expectedPort: port + 3 } ] }); @@ -38,28 +38,28 @@ function testRunnerMain() { spawnMaster({ execArgv: ['--inspect', `--inspect-port=${port}`], - workers: [{expectedPort: port + 1}] + workers: [{ expectedPort: port + 1 }] }); port = debuggerPort + offset++ * 5; spawnMaster({ execArgv: ['--inspect', `--debug-port=${port}`], - workers: [{expectedPort: port + 1}] + workers: [{ expectedPort: port + 1 }] }); port = debuggerPort + offset++ * 5; spawnMaster({ execArgv: [`--inspect=0.0.0.0:${port}`], - workers: [{expectedPort: port + 1, expectedHost: '0.0.0.0'}] + workers: [{ expectedPort: port + 1, expectedHost: '0.0.0.0' }] }); port = debuggerPort + offset++ * 5; spawnMaster({ execArgv: [`--inspect=127.0.0.1:${port}`], - workers: [{expectedPort: port + 1, expectedHost: '127.0.0.1'}] + workers: [{ expectedPort: port + 1, expectedHost: '127.0.0.1' }] }); if (common.hasIPv6) { @@ -67,14 +67,14 @@ function testRunnerMain() { spawnMaster({ execArgv: [`--inspect=[::]:${port}`], - workers: [{expectedPort: port + 1, expectedHost: '::'}] + workers: [{ expectedPort: port + 1, expectedHost: '::' }] }); port = debuggerPort + offset++ * 5; spawnMaster({ execArgv: [`--inspect=[::1]:${port}`], - workers: [{expectedPort: port + 1, expectedHost: '::1'}] + workers: [{ expectedPort: port + 1, expectedHost: '::1' }] }); } @@ -85,18 +85,18 @@ function testRunnerMain() { spawnMaster({ execArgv: [`--inspect=${port}`], - clusterSettings: {inspectPort: port + 2}, - workers: [{expectedPort: port + 2}] + clusterSettings: { inspectPort: port + 2 }, + workers: [{ expectedPort: port + 2 }] }); port = debuggerPort + offset++ * 5; spawnMaster({ execArgv: [`--inspect=${port}`], - clusterSettings: {inspectPort: 'addTwo'}, + clusterSettings: { inspectPort: 'addTwo' }, workers: [ - {expectedPort: port + 2}, - {expectedPort: port + 4} + { expectedPort: port + 2 }, + { expectedPort: port + 4 } ] }); @@ -104,7 +104,7 @@ function testRunnerMain() { spawnMaster({ execArgv: [`--inspect=${port}`], - clusterSettings: {inspectPort: 'string'}, + clusterSettings: { inspectPort: 'string' }, workers: [{}] }); @@ -112,7 +112,7 @@ function testRunnerMain() { spawnMaster({ execArgv: [`--inspect=${port}`], - clusterSettings: {inspectPort: 'null'}, + clusterSettings: { inspectPort: 'null' }, workers: [{}] }); @@ -120,7 +120,7 @@ function testRunnerMain() { spawnMaster({ execArgv: [`--inspect=${port}`], - clusterSettings: {inspectPort: 'bignumber'}, + clusterSettings: { inspectPort: 'bignumber' }, workers: [{}] }); @@ -128,7 +128,7 @@ function testRunnerMain() { spawnMaster({ execArgv: [`--inspect=${port}`], - clusterSettings: {inspectPort: 'negativenumber'}, + clusterSettings: { inspectPort: 'negativenumber' }, workers: [{}] }); @@ -136,7 +136,7 @@ function testRunnerMain() { spawnMaster({ execArgv: [`--inspect=${port}`], - clusterSettings: {inspectPort: 'bignumberfunc'}, + clusterSettings: { inspectPort: 'bignumberfunc' }, workers: [{}] }); @@ -144,7 +144,7 @@ function testRunnerMain() { spawnMaster({ execArgv: [`--inspect=${port}`], - clusterSettings: {inspectPort: 'strfunc'}, + clusterSettings: { inspectPort: 'strfunc' }, workers: [{}] }); @@ -152,9 +152,9 @@ function testRunnerMain() { spawnMaster({ execArgv: [], - clusterSettings: {inspectPort: port, execArgv: ['--inspect']}, + clusterSettings: { inspectPort: port, execArgv: ['--inspect'] }, workers: [ - {expectedPort: port} + { expectedPort: port } ] }); @@ -162,11 +162,11 @@ function testRunnerMain() { spawnMaster({ execArgv: [`--inspect=${port}`], - clusterSettings: {inspectPort: 0}, + clusterSettings: { inspectPort: 0 }, workers: [ - {expectedInitialPort: 0}, - {expectedInitialPort: 0}, - {expectedInitialPort: 0} + { expectedInitialPort: 0 }, + { expectedInitialPort: 0 }, + { expectedInitialPort: 0 } ] }); @@ -174,11 +174,11 @@ function testRunnerMain() { spawnMaster({ execArgv: [], - clusterSettings: {inspectPort: 0}, + clusterSettings: { inspectPort: 0 }, workers: [ - {expectedInitialPort: 0}, - {expectedInitialPort: 0}, - {expectedInitialPort: 0} + { expectedInitialPort: 0 }, + { expectedInitialPort: 0 }, + { expectedInitialPort: 0 } ] }); @@ -186,9 +186,9 @@ function testRunnerMain() { port = debuggerPort + offset++ * 5; defaultPortCase = spawnMaster({ execArgv: ['--inspect'], - clusterSettings: {inspectPort: port + 2}, + clusterSettings: { inspectPort: port + 2 }, workers: [ - {expectedInitialPort: port + 2} + { expectedInitialPort: port + 2 } ] }); }); @@ -290,7 +290,7 @@ function masterProcessMain() { } function workerProcessMain() { - const {expectedPort, expectedInitialPort, expectedHost} = process.env; + const { expectedPort, expectedInitialPort, expectedHost } = process.env; const debugOptions = process.binding('config').debugOptions; if ('expectedPort' in process.env) { @@ -308,7 +308,7 @@ function workerProcessMain() { process.exit(); } -function spawnMaster({execArgv, workers, clusterSettings = {}}) { +function spawnMaster({ execArgv, workers, clusterSettings = {} }) { return new Promise((resolve) => { childProcess.fork(__filename, { env: { diff --git a/test/inspector/test-inspector.js b/test/inspector/test-inspector.js index 313fba9bd9..9d5cf9aa3a 100644 --- a/test/inspector/test-inspector.js +++ b/test/inspector/test-inspector.js @@ -103,14 +103,14 @@ function testBreakpointOnStart(session) { { 'method': 'Runtime.enable' }, { 'method': 'Debugger.enable' }, { 'method': 'Debugger.setPauseOnExceptions', - 'params': {'state': 'none'} }, + 'params': { 'state': 'none' } }, { 'method': 'Debugger.setAsyncCallStackDepth', - 'params': {'maxDepth': 0} }, + 'params': { 'maxDepth': 0 } }, { 'method': 'Profiler.enable' }, { 'method': 'Profiler.setSamplingInterval', - 'params': {'interval': 100} }, + 'params': { 'interval': 100 } }, { 'method': 'Debugger.setBlackboxPatterns', - 'params': {'patterns': []} }, + 'params': { 'patterns': [] } }, { 'method': 'Runtime.runIfWaitingForDebugger' } ]; @@ -129,7 +129,7 @@ function testSetBreakpointAndResume(session) { 'condition': '' } }, - { 'method': 'Debugger.resume'}, + { 'method': 'Debugger.resume' }, [ { 'method': 'Debugger.getScriptSource', 'params': { 'scriptId': session.mainScriptId } }, expectMainScriptSource ], @@ -155,7 +155,7 @@ function testInspectScope(session) { 'accessorPropertiesOnly': false, 'generatePreview': true } - }, setupExpectScopeValues({t: 1001, k: 1}) + }, setupExpectScopeValues({ t: 1001, k: 1 }) ], [ { @@ -211,7 +211,7 @@ function testI18NCharacters(session) { function testWaitsForFrontendDisconnect(session, harness) { console.log('[test]', 'Verify node waits for the frontend to disconnect'); - session.sendInspectorCommands({ 'method': 'Debugger.resume'}) + session.sendInspectorCommands({ 'method': 'Debugger.resume' }) .expectMessages(setupExpectContextDestroyed(1)) .expectStderrOutput('Waiting for the debugger to disconnect...') .disconnect(true); diff --git a/test/internet/test-dgram-broadcast-multi-process.js b/test/internet/test-dgram-broadcast-multi-process.js index 0ec4bbd9ce..82ddd7743f 100644 --- a/test/internet/test-dgram-broadcast-multi-process.js +++ b/test/internet/test-dgram-broadcast-multi-process.js @@ -233,7 +233,7 @@ if (process.argv[2] === 'child') { receivedMessages.push(buf); - process.send({message: buf.toString()}); + process.send({ message: buf.toString() }); if (receivedMessages.length === messages.length) { process.nextTick(function() { @@ -252,7 +252,7 @@ if (process.argv[2] === 'child') { }); listenSocket.on('listening', function() { - process.send({listening: true}); + process.send({ listening: true }); }); listenSocket.bind(common.PORT); diff --git a/test/internet/test-dns-ipv4.js b/test/internet/test-dns-ipv4.js index 4d4c7da6a7..d3d5ba2200 100644 --- a/test/internet/test-dns-ipv4.js +++ b/test/internet/test-dns-ipv4.js @@ -155,7 +155,7 @@ TEST(function test_lookup_localhost_ipv4(done) { TEST(function test_lookup_all_ipv4(done) { const req = dns.lookup( 'www.google.com', - {all: true, family: 4}, + { all: true, family: 4 }, common.mustCall((err, ips) => { assert.ifError(err); assert.ok(Array.isArray(ips)); @@ -190,7 +190,7 @@ TEST(function test_lookupservice_ip_ipv4(done) { TEST(function test_lookupservice_ip_ipv4_promise(done) { util.promisify(dns.lookupService)('127.0.0.1', 80) - .then(common.mustCall(({hostname, service}) => { + .then(common.mustCall(({ hostname, service }) => { assert.strictEqual(typeof hostname, 'string'); assert(hostname.length > 0); assert(['http', 'www', '80'].includes(service)); diff --git a/test/internet/test-dns-ipv6.js b/test/internet/test-dns-ipv6.js index 9b9360c2a1..a91b108456 100644 --- a/test/internet/test-dns-ipv6.js +++ b/test/internet/test-dns-ipv6.js @@ -154,7 +154,7 @@ TEST(function test_lookup_ip_ipv6(done) { TEST(function test_lookup_all_ipv6(done) { const req = dns.lookup( 'www.google.com', - {all: true, family: 6}, + { all: true, family: 6 }, common.mustCall((err, ips) => { assert.ifError(err); assert.ok(Array.isArray(ips)); diff --git a/test/internet/test-dns.js b/test/internet/test-dns.js index e4bdfe51b7..aa596822df 100644 --- a/test/internet/test-dns.js +++ b/test/internet/test-dns.js @@ -403,22 +403,26 @@ TEST(function test_lookup_failure(done) { TEST(function test_lookup_ip_all(done) { - const req = dns.lookup('127.0.0.1', {all: true}, function(err, ips, family) { - assert.ifError(err); - assert.ok(Array.isArray(ips)); - assert.ok(ips.length > 0); - assert.strictEqual(ips[0].address, '127.0.0.1'); - assert.strictEqual(ips[0].family, 4); + const req = dns.lookup( + '127.0.0.1', + { all: true }, + function(err, ips, family) { + assert.ifError(err); + assert.ok(Array.isArray(ips)); + assert.ok(ips.length > 0); + assert.strictEqual(ips[0].address, '127.0.0.1'); + assert.strictEqual(ips[0].family, 4); - done(); - }); + done(); + } + ); checkWrap(req); }); TEST(function test_lookup_ip_all_promise(done) { - const req = util.promisify(dns.lookup)('127.0.0.1', {all: true}) + const req = util.promisify(dns.lookup)('127.0.0.1', { all: true }) .then(function(ips) { assert.ok(Array.isArray(ips)); assert.ok(ips.length > 0); @@ -444,7 +448,7 @@ TEST(function test_lookup_ip_promise(done) { TEST(function test_lookup_null_all(done) { - const req = dns.lookup(null, {all: true}, function(err, ips, family) { + const req = dns.lookup(null, { all: true }, function(err, ips, family) { assert.ifError(err); assert.ok(Array.isArray(ips)); assert.strictEqual(ips.length, 0); @@ -457,7 +461,7 @@ TEST(function test_lookup_null_all(done) { TEST(function test_lookup_all_mixed(done) { - const req = dns.lookup('www.google.com', {all: true}, function(err, ips) { + const req = dns.lookup('www.google.com', { all: true }, function(err, ips) { assert.ifError(err); assert.ok(Array.isArray(ips)); assert.ok(ips.length > 0); diff --git a/test/internet/test-tls-reuse-host-from-socket.js b/test/internet/test-tls-reuse-host-from-socket.js index 73ee91d3b2..8501efd74e 100644 --- a/test/internet/test-tls-reuse-host-from-socket.js +++ b/test/internet/test-tls-reuse-host-from-socket.js @@ -30,7 +30,7 @@ const tls = require('tls'); const net = require('net'); const socket = net.connect(443, 'www.example.org', common.mustCall(() => { - const secureSocket = tls.connect({socket: socket}, common.mustCall(() => { + const secureSocket = tls.connect({ socket: socket }, common.mustCall(() => { secureSocket.destroy(); console.log('ok'); })); diff --git a/test/known_issues/test-stdin-is-always-net.socket.js b/test/known_issues/test-stdin-is-always-net.socket.js index 78c1a7d2ea..9a4c524c4a 100644 --- a/test/known_issues/test-stdin-is-always-net.socket.js +++ b/test/known_issues/test-stdin-is-always-net.socket.js @@ -11,7 +11,11 @@ if (process.argv[2] === 'child') { return; } -const proc = spawn(process.execPath, [__filename, 'child'], {stdio: 'ignore'}); +const proc = spawn( + process.execPath, + [__filename, 'child'], + { stdio: 'ignore' } +); // To double-check this test, set stdio to 'pipe' and uncomment the line below. // proc.stderr.pipe(process.stderr); proc.on('exit', common.mustCall(function(exitCode) { diff --git a/test/known_issues/test-vm-inherited_properties.js b/test/known_issues/test-vm-inherited_properties.js index f90cf3568e..3df9c57219 100644 --- a/test/known_issues/test-vm-inherited_properties.js +++ b/test/known_issues/test-vm-inherited_properties.js @@ -10,7 +10,7 @@ const base = { }; const sandbox = Object.create(base, { - propSandbox: {value: 3} + propSandbox: { value: 3 } }); const context = vm.createContext(sandbox); diff --git a/test/known_issues/test-vm-proxy-failure-CP.js b/test/known_issues/test-vm-proxy-failure-CP.js index de644599b2..39e890bdb9 100644 --- a/test/known_issues/test-vm-proxy-failure-CP.js +++ b/test/known_issues/test-vm-proxy-failure-CP.js @@ -13,7 +13,7 @@ const handler = { throw new Error('whoops'); } }; -const sandbox = new Proxy({foo: 'bar'}, handler); +const sandbox = new Proxy({ foo: 'bar' }, handler); const context = vm.createContext(sandbox); diff --git a/test/message/vm_display_runtime_error.js b/test/message/vm_display_runtime_error.js index 8a40a03a03..230c45feab 100644 --- a/test/message/vm_display_runtime_error.js +++ b/test/message/vm_display_runtime_error.js @@ -26,7 +26,7 @@ const vm = require('vm'); console.error('beginning'); try { - vm.runInThisContext('throw new Error("boo!")', { filename: 'test.vm'}); + vm.runInThisContext('throw new Error("boo!")', { filename: 'test.vm' }); } catch (err) { console.error(err.stack); } diff --git a/test/parallel/test-assert-deep.js b/test/parallel/test-assert-deep.js index 2858a22503..51f07af09e 100644 --- a/test/parallel/test-assert-deep.js +++ b/test/parallel/test-assert-deep.js @@ -86,8 +86,8 @@ assert.throws(() => assert.deepStrictEqual(re1, re2), // For these weird cases, deepEqual should pass (at least for now), // but deepStrictEqual should throw. const similar = new Set([ - {0: '1'}, // Object - {0: 1}, // Object + { 0: '1' }, // Object + { 0: 1 }, // Object new String('1'), // Object ['1'], // Array [1], // Array @@ -115,7 +115,7 @@ for (const a of similar) { } common.expectsError(() => { - assert.deepEqual(new Set([{a: 0}]), new Set([{a: 1}])); + assert.deepEqual(new Set([{ a: 0 }]), new Set([{ a: 1 }])); }, { code: 'ERR_ASSERTION', message: /^Set { { a: 0 } } deepEqual Set { { a: 1 } }$/ @@ -181,7 +181,7 @@ assertNotDeepOrStrict(new Set([1]), [1]); assertNotDeepOrStrict(new Set(), []); assertNotDeepOrStrict(new Set(), {}); -assertNotDeepOrStrict(new Map([['a', 1]]), {a: 1}); +assertNotDeepOrStrict(new Map([['a', 1]]), { a: 1 }); assertNotDeepOrStrict(new Map(), []); assertNotDeepOrStrict(new Map(), {}); @@ -195,24 +195,24 @@ assertDeepAndStrictEqual(new Set([{}]), new Set([{}])); // Ref: https://github.com/nodejs/node/issues/13347 assertNotDeepOrStrict( - new Set([{a: 1}, {a: 1}]), - new Set([{a: 1}, {a: 2}]) + new Set([{ a: 1 }, { a: 1 }]), + new Set([{ a: 1 }, { a: 2 }]) ); assertNotDeepOrStrict( - new Set([{a: 1}, {a: 1}, {a: 2}]), - new Set([{a: 1}, {a: 2}, {a: 2}]) + new Set([{ a: 1 }, { a: 1 }, { a: 2 }]), + new Set([{ a: 1 }, { a: 2 }, { a: 2 }]) ); assertNotDeepOrStrict( - new Map([[{x: 1}, 5], [{x: 1}, 5]]), - new Map([[{x: 1}, 5], [{x: 2}, 5]]) + new Map([[{ x: 1 }, 5], [{ x: 1 }, 5]]), + new Map([[{ x: 1 }, 5], [{ x: 2 }, 5]]) ); assertNotDeepOrStrict(new Set([3, '3']), new Set([3, 4])); assertNotDeepOrStrict(new Map([[3, 0], ['3', 0]]), new Map([[3, 0], [4, 0]])); assertNotDeepOrStrict( - new Set([{a: 1}, {a: 1}, {a: 2}]), - new Set([{a: 1}, {a: 2}, {a: 2}]) + new Set([{ a: 1 }, { a: 1 }, { a: 2 }]), + new Set([{ a: 1 }, { a: 2 }, { a: 2 }]) ); // Mixed primitive and object keys @@ -319,7 +319,7 @@ assertOnlyDeepEqual( assertDeepAndStrictEqual(new Set(values), new Set(values)); assertDeepAndStrictEqual(new Set(values), new Set(values.reverse())); - const mapValues = values.map((v) => [v, {a: 5}]); + const mapValues = values.map((v) => [v, { a: 5 }]); assertDeepAndStrictEqual(new Map(mapValues), new Map(mapValues)); assertDeepAndStrictEqual(new Map(mapValues), new Map(mapValues.reverse())); } @@ -337,7 +337,7 @@ assertOnlyDeepEqual( { const m1 = new Map(); const m2 = new Map(); - const obj = {a: 5, b: 6}; + const obj = { a: 5, b: 6 }; m1.set(1, obj); m1.set(2, 'hi'); m1.set(3, [1, 2, 3]); diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js index a79da93d82..006b7e905a 100644 --- a/test/parallel/test-assert.js +++ b/test/parallel/test-assert.js @@ -163,14 +163,14 @@ assert.throws(makeBlock(a.deepEqual, 4, '5'), 'deepEqual( 4, \'5\')'); // having the same number of owned properties && the same set of keys -assert.doesNotThrow(makeBlock(a.deepEqual, {a: 4}, {a: 4})); -assert.doesNotThrow(makeBlock(a.deepEqual, {a: 4, b: '2'}, {a: 4, b: '2'})); +assert.doesNotThrow(makeBlock(a.deepEqual, { a: 4 }, { a: 4 })); +assert.doesNotThrow(makeBlock(a.deepEqual, { a: 4, b: '2' }, { a: 4, b: '2' })); assert.doesNotThrow(makeBlock(a.deepEqual, [4], ['4'])); -assert.throws(makeBlock(a.deepEqual, {a: 4}, {a: 4, b: true}), +assert.throws(makeBlock(a.deepEqual, { a: 4 }, { a: 4, b: true }), a.AssertionError); -assert.doesNotThrow(makeBlock(a.deepEqual, ['a'], {0: 'a'})); +assert.doesNotThrow(makeBlock(a.deepEqual, ['a'], { 0: 'a' })); //(although not necessarily the same order), -assert.doesNotThrow(makeBlock(a.deepEqual, {a: 4, b: '1'}, {b: '1', a: 4})); +assert.doesNotThrow(makeBlock(a.deepEqual, { a: 4, b: '1' }, { b: '1', a: 4 })); const a1 = [1, 2, 3]; const a2 = [1, 2, 3]; a1.a = 'test'; @@ -213,7 +213,7 @@ assert.doesNotThrow(makeBlock(a.deepEqual, nb1, nb2)); assert.throws(makeBlock(a.deepEqual, null, {}), a.AssertionError); assert.throws(makeBlock(a.deepEqual, undefined, {}), a.AssertionError); assert.throws(makeBlock(a.deepEqual, 'a', ['a']), a.AssertionError); -assert.throws(makeBlock(a.deepEqual, 'a', {0: 'a'}), a.AssertionError); +assert.throws(makeBlock(a.deepEqual, 'a', { 0: 'a' }), a.AssertionError); assert.throws(makeBlock(a.deepEqual, 1, {}), a.AssertionError); assert.throws(makeBlock(a.deepEqual, true, {}), a.AssertionError); assert.throws(makeBlock(a.deepEqual, Symbol(), {}), a.AssertionError); @@ -221,7 +221,7 @@ assert.throws(makeBlock(a.deepEqual, Symbol(), {}), a.AssertionError); // primitive wrappers and object assert.doesNotThrow(makeBlock(a.deepEqual, new String('a'), ['a']), a.AssertionError); -assert.doesNotThrow(makeBlock(a.deepEqual, new String('a'), {0: 'a'}), +assert.doesNotThrow(makeBlock(a.deepEqual, new String('a'), { 0: 'a' }), a.AssertionError); assert.doesNotThrow(makeBlock(a.deepEqual, new Number(1), {}), a.AssertionError); @@ -229,7 +229,7 @@ assert.doesNotThrow(makeBlock(a.deepEqual, new Boolean(true), {}), a.AssertionError); // same number of keys but different key names -assert.throws(makeBlock(a.deepEqual, {a: 1}, {b: 1}), a.AssertionError); +assert.throws(makeBlock(a.deepEqual, { a: 1 }, { b: 1 }), a.AssertionError); //deepStrictEqual assert.doesNotThrow( @@ -314,23 +314,23 @@ assert.throws(makeBlock(a.deepStrictEqual, 4, '5'), 'deepStrictEqual(4, \'5\')'); // having the same number of owned properties && the same set of keys -assert.doesNotThrow(makeBlock(a.deepStrictEqual, {a: 4}, {a: 4})); +assert.doesNotThrow(makeBlock(a.deepStrictEqual, { a: 4 }, { a: 4 })); assert.doesNotThrow(makeBlock(a.deepStrictEqual, - {a: 4, b: '2'}, - {a: 4, b: '2'})); + { a: 4, b: '2' }, + { a: 4, b: '2' })); assert.throws(makeBlock(a.deepStrictEqual, [4], ['4']), common.expectsError({ code: 'ERR_ASSERTION', type: a.AssertionError, message: /^\[ 4 ] deepStrictEqual \[ '4' ]$/ })); -assert.throws(makeBlock(a.deepStrictEqual, {a: 4}, {a: 4, b: true}), +assert.throws(makeBlock(a.deepStrictEqual, { a: 4 }, { a: 4, b: true }), common.expectsError({ code: 'ERR_ASSERTION', type: a.AssertionError, message: /^{ a: 4 } deepStrictEqual { a: 4, b: true }$/ })); -assert.throws(makeBlock(a.deepStrictEqual, ['a'], {0: 'a'}), +assert.throws(makeBlock(a.deepStrictEqual, ['a'], { 0: 'a' }), common.expectsError({ code: 'ERR_ASSERTION', type: a.AssertionError, @@ -338,8 +338,8 @@ assert.throws(makeBlock(a.deepStrictEqual, ['a'], {0: 'a'}), })); //(although not necessarily the same order), assert.doesNotThrow(makeBlock(a.deepStrictEqual, - {a: 4, b: '1'}, - {b: '1', a: 4})); + { a: 4, b: '1' }, + { b: '1', a: 4 })); assert.throws(makeBlock(a.deepStrictEqual, [0, 1, 2, 'a', 'b'], @@ -385,7 +385,7 @@ assert.doesNotThrow(makeBlock(assert.deepStrictEqual, s, s)); assert.throws(makeBlock(a.deepStrictEqual, null, {}), a.AssertionError); assert.throws(makeBlock(a.deepStrictEqual, undefined, {}), a.AssertionError); assert.throws(makeBlock(a.deepStrictEqual, 'a', ['a']), a.AssertionError); -assert.throws(makeBlock(a.deepStrictEqual, 'a', {0: 'a'}), a.AssertionError); +assert.throws(makeBlock(a.deepStrictEqual, 'a', { 0: 'a' }), a.AssertionError); assert.throws(makeBlock(a.deepStrictEqual, 1, {}), a.AssertionError); assert.throws(makeBlock(a.deepStrictEqual, true, {}), a.AssertionError); assert.throws(makeBlock(assert.deepStrictEqual, Symbol(), {}), @@ -395,7 +395,7 @@ assert.throws(makeBlock(assert.deepStrictEqual, Symbol(), {}), // primitive wrappers and object assert.throws(makeBlock(a.deepStrictEqual, new String('a'), ['a']), a.AssertionError); -assert.throws(makeBlock(a.deepStrictEqual, new String('a'), {0: 'a'}), +assert.throws(makeBlock(a.deepStrictEqual, new String('a'), { 0: 'a' }), a.AssertionError); assert.throws(makeBlock(a.deepStrictEqual, new Number(1), {}), a.AssertionError); @@ -576,7 +576,7 @@ a.throws(makeBlock(thrower, TypeError), function(err) { const g = {}; g.ref = g; - const h = {ref: g}; + const h = { ref: g }; a.throws(makeBlock(a.deepEqual, f, h), /AssertionError/); a.throws(makeBlock(a.deepStrictEqual, f, h), /AssertionError/); @@ -597,7 +597,7 @@ a.throws(makeBlock(a.deepEqual, args, [])); a.throws(makeBlock(a.deepEqual, someArgs, ['a'])); a.throws(makeBlock(a.deepEqual, ['a'], someArgs)); - a.throws(makeBlock(a.deepEqual, someArgs, {'0': 'a'})); + a.throws(makeBlock(a.deepEqual, someArgs, { '0': 'a' })); a.throws(makeBlock(a.deepEqual, someArgs, diffArgs)); a.doesNotThrow(makeBlock(a.deepEqual, someArgs, sameArgs)); } @@ -634,7 +634,7 @@ a.throws(makeBlock(a.deepEqual, args, [])); })); } -const circular = {y: 1}; +const circular = { y: 1 }; circular.x = circular; function testAssertionMessage(actual, expected) { @@ -666,8 +666,8 @@ testAssertionMessage(function f() {}, '[Function: f]'); testAssertionMessage(function() {}, '[Function]'); testAssertionMessage({}, '{}'); testAssertionMessage(circular, '{ y: 1, x: [Circular] }'); -testAssertionMessage({a: undefined, b: null}, '{ a: undefined, b: null }'); -testAssertionMessage({a: NaN, b: Infinity, c: -Infinity}, +testAssertionMessage({ a: undefined, b: null }, '{ a: undefined, b: null }'); +testAssertionMessage({ a: NaN, b: Infinity, c: -Infinity }, '{ a: NaN, b: Infinity, c: -Infinity }'); // #2893 @@ -755,7 +755,7 @@ assert.throws(() => { assert.strictEqual('A'.repeat(1000), ''); }, common.expectsError({ code: 'ERR_ASSERTION', - message: new RegExp(`^'${'A'.repeat(127)} === ''$`)})); + message: new RegExp(`^'${'A'.repeat(127)} === ''$`) })); { // bad args to AssertionError constructor should throw TypeError diff --git a/test/parallel/test-async-hooks-http-agent.js b/test/parallel/test-async-hooks-http-agent.js index 348b97b111..ff19d089a0 100644 --- a/test/parallel/test-async-hooks-http-agent.js +++ b/test/parallel/test-async-hooks-http-agent.js @@ -17,7 +17,7 @@ const agent = new http.Agent({ const server = http.createServer(common.mustCall((req, res) => { req.once('data', common.mustCallAtLeast(() => { - res.writeHead(200, {'Content-Type': 'text/plain'}); + res.writeHead(200, { 'Content-Type': 'text/plain' }); res.write('foo'); })); req.on('end', common.mustCall(() => { diff --git a/test/parallel/test-async-hooks-promise.js b/test/parallel/test-async-hooks-promise.js index ea5e59d319..c2d7bc76da 100644 --- a/test/parallel/test-async-hooks-promise.js +++ b/test/parallel/test-async-hooks-promise.js @@ -8,7 +8,7 @@ const initCalls = []; async_hooks.createHook({ init: common.mustCall((id, type, triggerId, resource) => { assert.strictEqual(type, 'PROMISE'); - initCalls.push({id, triggerId, resource}); + initCalls.push({ id, triggerId, resource }); }, 2) }).enable(); diff --git a/test/parallel/test-benchmark-crypto.js b/test/parallel/test-benchmark-crypto.js index 25dbc95b4c..682c127643 100644 --- a/test/parallel/test-benchmark-crypto.js +++ b/test/parallel/test-benchmark-crypto.js @@ -27,7 +27,7 @@ const argv = ['--set', 'algo=sha256', '--set', 'writes=1', 'crypto']; -const child = fork(runjs, argv, {env: {NODEJS_BENCHMARK_ZERO_ALLOWED: 1}}); +const child = fork(runjs, argv, { env: { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 } }); child.on('exit', (code, signal) => { assert.strictEqual(code, 0); assert.strictEqual(signal, null); diff --git a/test/parallel/test-benchmark-timers.js b/test/parallel/test-benchmark-timers.js index 5026de1a8e..cfb7a14d40 100644 --- a/test/parallel/test-benchmark-timers.js +++ b/test/parallel/test-benchmark-timers.js @@ -14,7 +14,7 @@ const argv = ['--set', 'thousands=0.001', '--set', 'millions=0.000001', 'timers']; -const child = fork(runjs, argv, {env: {NODEJS_BENCHMARK_ZERO_ALLOWED: 1}}); +const child = fork(runjs, argv, { env: { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 } }); child.on('exit', (code, signal) => { assert.strictEqual(code, 0); assert.strictEqual(signal, null); diff --git a/test/parallel/test-buffer-alloc.js b/test/parallel/test-buffer-alloc.js index 77c0c60425..2282d66a36 100644 --- a/test/parallel/test-buffer-alloc.js +++ b/test/parallel/test-buffer-alloc.js @@ -266,10 +266,10 @@ assert.doesNotThrow(() => Buffer.alloc(1).write('', 1, 0)); // Test construction from arrayish object { - const arrayIsh = {0: 0, 1: 1, 2: 2, 3: 3, length: 4}; + const arrayIsh = { 0: 0, 1: 1, 2: 2, 3: 3, length: 4 }; let g = Buffer.from(arrayIsh); assert.deepStrictEqual(g, Buffer.from([0, 1, 2, 3])); - const strArrayIsh = {0: '0', 1: '1', 2: '2', 3: '3', length: 4}; + const strArrayIsh = { 0: '0', 1: '1', 2: '2', 3: '3', length: 4 }; g = Buffer.from(strArrayIsh); assert.deepStrictEqual(g, Buffer.from([0, 1, 2, 3])); } @@ -754,8 +754,8 @@ Buffer.allocUnsafe(3.3).fill().toString(); Buffer.alloc(3.3).fill().toString(); assert.strictEqual(Buffer.allocUnsafe(NaN).length, 0); assert.strictEqual(Buffer.allocUnsafe(3.3).length, 3); -assert.strictEqual(Buffer.from({length: 3.3}).length, 3); -assert.strictEqual(Buffer.from({length: 'BAM'}).length, 0); +assert.strictEqual(Buffer.from({ length: 3.3 }).length, 3); +assert.strictEqual(Buffer.from({ length: 'BAM' }).length, 0); // Make sure that strings are not coerced to numbers. assert.strictEqual(Buffer.from('99').length, 2); @@ -977,7 +977,7 @@ assert.throws(() => { const b = Buffer.alloc(1); a.copy(b, 0, 0x100000000, 0x100000001); }, common.expectsError( - {code: undefined, type: RangeError, message: 'Index out of range'})); + { code: undefined, type: RangeError, message: 'Index out of range' })); // Unpooled buffer (replaces SlowBuffer) { diff --git a/test/parallel/test-buffer-compare-offset.js b/test/parallel/test-buffer-compare-offset.js index 3b7ef7edd3..5d30b96c3e 100644 --- a/test/parallel/test-buffer-compare-offset.js +++ b/test/parallel/test-buffer-compare-offset.js @@ -49,7 +49,7 @@ assert.strictEqual(-1, a.compare(b, 0, 7, 4, 6)); assert.strictEqual(1, a.compare(b, 0, null)); // coerces to targetEnd == 5 -assert.strictEqual(-1, a.compare(b, 0, {valueOf: () => 5})); +assert.strictEqual(-1, a.compare(b, 0, { valueOf: () => 5 })); // zero length target assert.strictEqual(1, a.compare(b, Infinity, -Infinity)); @@ -57,7 +57,7 @@ assert.strictEqual(1, a.compare(b, Infinity, -Infinity)); // zero length target because default for targetEnd <= targetSource assert.strictEqual(1, a.compare(b, '0xff')); -const oor = common.expectsError({code: 'ERR_INDEX_OUT_OF_RANGE'}, 7); +const oor = common.expectsError({ code: 'ERR_INDEX_OUT_OF_RANGE' }, 7); assert.throws(() => a.compare(b, 0, 100, 0), oor); assert.throws(() => a.compare(b, 0, 1, 0, 100), oor); diff --git a/test/parallel/test-buffer-fill.js b/test/parallel/test-buffer-fill.js index eb3629f954..f35dcc66e0 100644 --- a/test/parallel/test-buffer-fill.js +++ b/test/parallel/test-buffer-fill.js @@ -194,16 +194,16 @@ deepStrictEqualValues(genBuffer(4, [hexBufFill, 1, -1]), [0, 0, 0, 0]); // Check exceptions assert.throws( () => buf1.fill(0, -1), - common.expectsError({code: 'ERR_INDEX_OUT_OF_RANGE'})); + common.expectsError({ code: 'ERR_INDEX_OUT_OF_RANGE' })); assert.throws( () => buf1.fill(0, 0, buf1.length + 1), - common.expectsError({code: 'ERR_INDEX_OUT_OF_RANGE'})); + common.expectsError({ code: 'ERR_INDEX_OUT_OF_RANGE' })); assert.throws( () => buf1.fill('', -1), - common.expectsError({code: 'ERR_INDEX_OUT_OF_RANGE'})); + common.expectsError({ code: 'ERR_INDEX_OUT_OF_RANGE' })); assert.throws( () => buf1.fill('', 0, buf1.length + 1), - common.expectsError({code: 'ERR_INDEX_OUT_OF_RANGE'})); + common.expectsError({ code: 'ERR_INDEX_OUT_OF_RANGE' })); assert.throws( () => buf1.fill('a', 0, buf1.length, 'node rocks!'), common.expectsError({ @@ -301,10 +301,10 @@ function testBufs(string, offset, length, encoding) { // Make sure these throw. assert.throws( () => Buffer.allocUnsafe(8).fill('a', -1), - common.expectsError({code: 'ERR_INDEX_OUT_OF_RANGE'})); + common.expectsError({ code: 'ERR_INDEX_OUT_OF_RANGE' })); assert.throws( () => Buffer.allocUnsafe(8).fill('a', 0, 9), - common.expectsError({code: 'ERR_INDEX_OUT_OF_RANGE'})); + common.expectsError({ code: 'ERR_INDEX_OUT_OF_RANGE' })); // Make sure this doesn't hang indefinitely. Buffer.allocUnsafe(8).fill(''); @@ -371,7 +371,7 @@ Buffer.alloc(8, ''); }; Buffer.alloc(1).fill(Buffer.alloc(1), start, 1); }, common.expectsError( - {code: undefined, type: RangeError, message: 'Index out of range'})); + { code: undefined, type: RangeError, message: 'Index out of range' })); // Make sure -1 is making it to Buffer::Fill(). assert.ok(elseWasLast, 'internal API changed, -1 no longer in correct location'); @@ -382,7 +382,7 @@ Buffer.alloc(8, ''); assert.throws(() => { process.binding('buffer').fill(Buffer.alloc(1), 1, -1, 0, 1); }, common.expectsError( - {code: undefined, type: RangeError, message: 'Index out of range'})); + { code: undefined, type: RangeError, message: 'Index out of range' })); // Make sure "end" is properly checked, even if it's magically mangled using // Symbol.toPrimitive. @@ -406,7 +406,7 @@ assert.throws(() => { }; Buffer.alloc(1).fill(Buffer.alloc(1), 0, end); }, common.expectsError( - {code: undefined, type: RangeError, message: 'Index out of range'})); + { code: undefined, type: RangeError, message: 'Index out of range' })); // Make sure -1 is making it to Buffer::Fill(). assert.ok(elseWasLast, 'internal API changed, -1 no longer in correct location'); @@ -417,7 +417,7 @@ assert.throws(() => { assert.throws(() => { process.binding('buffer').fill(Buffer.alloc(1), 1, 1, -2, 1); }, common.expectsError( - { code: undefined, type: RangeError, message: 'Index out of range'})); + { code: undefined, type: RangeError, message: 'Index out of range' })); // Test that bypassing 'length' won't cause an abort. assert.throws(() => { @@ -428,7 +428,7 @@ assert.throws(() => { }); buf.fill(''); }, common.expectsError( - { code: undefined, type: RangeError, message: 'Index out of range'})); + { code: undefined, type: RangeError, message: 'Index out of range' })); assert.deepStrictEqual( Buffer.allocUnsafeSlow(16).fill('ab', 'utf16le'), diff --git a/test/parallel/test-buffer-from.js b/test/parallel/test-buffer-from.js index 523d343f70..c122ecd60b 100644 --- a/test/parallel/test-buffer-from.js +++ b/test/parallel/test-buffer-from.js @@ -31,7 +31,7 @@ deepStrictEqual(Buffer.from(new String(checkString)), check); deepStrictEqual(Buffer.from(new MyString()), check); deepStrictEqual(Buffer.from(new MyPrimitive()), check); deepStrictEqual(Buffer.from( - runInNewContext('new String(checkString)', {checkString})), + runInNewContext('new String(checkString)', { checkString })), check); [ diff --git a/test/parallel/test-buffer-read.js b/test/parallel/test-buffer-read.js index e55bc3435a..22abfbe357 100644 --- a/test/parallel/test-buffer-read.js +++ b/test/parallel/test-buffer-read.js @@ -10,7 +10,7 @@ function read(buff, funx, args, expected) { assert.strictEqual(buff[funx](...args), expected); assert.throws( () => buff[funx](-1), - common.expectsError({code: 'ERR_INDEX_OUT_OF_RANGE'}) + common.expectsError({ code: 'ERR_INDEX_OUT_OF_RANGE' }) ); assert.doesNotThrow( diff --git a/test/parallel/test-buffer-sharedarraybuffer.js b/test/parallel/test-buffer-sharedarraybuffer.js index 582841d679..6c526bd694 100644 --- a/test/parallel/test-buffer-sharedarraybuffer.js +++ b/test/parallel/test-buffer-sharedarraybuffer.js @@ -27,4 +27,4 @@ assert.deepStrictEqual(arr_buf, ar_buf, 0); assert.strictEqual(Buffer.byteLength(sab), sab.byteLength, 0); -assert.doesNotThrow(() => Buffer.from({buffer: sab})); +assert.doesNotThrow(() => Buffer.from({ buffer: sab })); diff --git a/test/parallel/test-buffer-tostring-range.js b/test/parallel/test-buffer-tostring-range.js index 8d9ae531e8..0fba12fabf 100644 --- a/test/parallel/test-buffer-tostring-range.js +++ b/test/parallel/test-buffer-tostring-range.js @@ -79,9 +79,9 @@ assert.strictEqual(rangeBuffer.toString('ascii', 0, 1.99), 'a'); assert.strictEqual(rangeBuffer.toString('ascii', 0, true), 'a'); // try toString() with a object as a encoding -assert.strictEqual(rangeBuffer.toString({toString: function() { +assert.strictEqual(rangeBuffer.toString({ toString: function() { return 'ascii'; -}}), 'abc'); +} }), 'abc'); // try toString() with 0 and null as the encoding assert.throws(() => { diff --git a/test/parallel/test-child-process-cwd.js b/test/parallel/test-child-process-cwd.js index 087a852434..e1dcf85b09 100644 --- a/test/parallel/test-child-process-cwd.js +++ b/test/parallel/test-child-process-cwd.js @@ -57,26 +57,27 @@ function testCwd(options, forCode, forData) { } // Assume these exist, and 'pwd' gives us the right directory back -testCwd({cwd: common.rootDir}, 0, common.rootDir); +testCwd({ cwd: common.rootDir }, 0, common.rootDir); if (common.isWindows) { - testCwd({cwd: process.env.windir}, 0, process.env.windir); + testCwd({ cwd: process.env.windir }, 0, process.env.windir); } else { - testCwd({cwd: '/dev'}, 0, '/dev'); + testCwd({ cwd: '/dev' }, 0, '/dev'); } // Assume does-not-exist doesn't exist, expect exitCode=-1 and errno=ENOENT { - testCwd({cwd: 'does-not-exist'}, -1).on('error', common.mustCall(function(e) { - assert.strictEqual(e.code, 'ENOENT'); - })); + testCwd({ cwd: 'does-not-exist' }, -1) + .on('error', common.mustCall(function(e) { + assert.strictEqual(e.code, 'ENOENT'); + })); } // Spawn() shouldn't try to chdir() so this should just work testCwd(undefined, 0); testCwd({}, 0); -testCwd({cwd: ''}, 0); -testCwd({cwd: undefined}, 0); -testCwd({cwd: null}, 0); +testCwd({ cwd: '' }, 0); +testCwd({ cwd: undefined }, 0); +testCwd({ cwd: null }, 0); // Check whether all tests actually returned assert.notStrictEqual(returns, 0); diff --git a/test/parallel/test-child-process-env.js b/test/parallel/test-child-process-env.js index 015ab4e0c0..65e2bb3f16 100644 --- a/test/parallel/test-child-process-env.js +++ b/test/parallel/test-child-process-env.js @@ -34,9 +34,9 @@ Object.setPrototypeOf(env, { let child; if (common.isWindows) { - child = spawn('cmd.exe', ['/c', 'set'], {env: env}); + child = spawn('cmd.exe', ['/c', 'set'], { env: env }); } else { - child = spawn('/usr/bin/env', [], {env: env}); + child = spawn('/usr/bin/env', [], { env: env }); } diff --git a/test/parallel/test-child-process-exec-cwd.js b/test/parallel/test-child-process-exec-cwd.js index f6719830c3..c16f77f4c5 100644 --- a/test/parallel/test-child-process-exec-cwd.js +++ b/test/parallel/test-child-process-exec-cwd.js @@ -34,7 +34,7 @@ if (common.isWindows) { dir = '/dev'; } -exec(pwdcommand, {cwd: dir}, common.mustCall(function(err, stdout, stderr) { +exec(pwdcommand, { cwd: dir }, common.mustCall(function(err, stdout, stderr) { assert.ifError(err); assert(stdout.startsWith(dir)); })); diff --git a/test/parallel/test-child-process-exec-maxBuffer.js b/test/parallel/test-child-process-exec-maxBuffer.js index 65674a8503..d23e8b9094 100644 --- a/test/parallel/test-child-process-exec-maxBuffer.js +++ b/test/parallel/test-child-process-exec-maxBuffer.js @@ -32,11 +32,11 @@ const unicode = '中文测试'; // length = 4, byte length = 12 { const cmd = `"${process.execPath}" -e "console.log('${unicode}');"`; - cp.exec(cmd, {maxBuffer: 10}, checkFactory('stdout')); + cp.exec(cmd, { maxBuffer: 10 }, checkFactory('stdout')); } { const cmd = `"${process.execPath}" -e "console.('${unicode}');"`; - cp.exec(cmd, {maxBuffer: 10}, checkFactory('stderr')); + cp.exec(cmd, { maxBuffer: 10 }, checkFactory('stderr')); } diff --git a/test/parallel/test-child-process-fork-exec-path.js b/test/parallel/test-child-process-fork-exec-path.js index aee99fbc7f..06c6244edd 100644 --- a/test/parallel/test-child-process-fork-exec-path.js +++ b/test/parallel/test-child-process-fork-exec-path.js @@ -24,7 +24,7 @@ const common = require('../common'); const assert = require('assert'); const fs = require('fs'); const path = require('path'); -const msg = {test: 'this'}; +const msg = { test: 'this' }; const nodePath = process.execPath; const copyPath = path.join(common.tmpDir, 'node-copy.exe'); diff --git a/test/parallel/test-child-process-fork-net.js b/test/parallel/test-child-process-fork-net.js index de0ec6ca00..1da92592ff 100644 --- a/test/parallel/test-child-process-fork-net.js +++ b/test/parallel/test-child-process-fork-net.js @@ -50,13 +50,13 @@ if (process.argv[2] === 'child') { server.on('connection', function(socket) { console.log('CHILD: got connection'); - process.send({what: 'connection'}); + process.send({ what: 'connection' }); socket.destroy(); }); // start making connection from parent console.log('CHILD: server listening'); - process.send({what: 'listening'}); + process.send({ what: 'listening' }); }); process.on('message', function onClose(msg) { @@ -64,7 +64,7 @@ if (process.argv[2] === 'child') { process.removeListener('message', onClose); serverScope.on('close', function() { - process.send({what: 'close'}); + process.send({ what: 'close' }); }); serverScope.close(); }); @@ -76,7 +76,7 @@ if (process.argv[2] === 'child') { console.log('CHILD: got socket'); }); - process.send({what: 'ready'}); + process.send({ what: 'ready' }); } else { const child = fork(process.argv[1], ['child']); @@ -93,7 +93,7 @@ if (process.argv[2] === 'child') { const progress = new ProgressTracker(2, function() { server.on('close', function() { console.log('PARENT: server closed'); - child.send({what: 'close'}); + child.send({ what: 'close' }); }); server.close(); }); @@ -111,7 +111,7 @@ if (process.argv[2] === 'child') { }); server.on('listening', function() { console.log('PARENT: server listening'); - child.send({what: 'server'}, server); + child.send({ what: 'server' }, server); }); server.listen(0); @@ -153,7 +153,7 @@ if (process.argv[2] === 'child') { socket.on('close', function() { console.log('CLIENT: socket closed'); }); - child.send({what: 'socket'}, socket); + child.send({ what: 'socket' }, socket); }); server.on('close', function() { console.log('PARENT: server closed'); diff --git a/test/parallel/test-child-process-fork-ref.js b/test/parallel/test-child-process-fork-ref.js index a88408674a..3eae2b242e 100644 --- a/test/parallel/test-child-process-fork-ref.js +++ b/test/parallel/test-child-process-fork-ref.js @@ -37,7 +37,7 @@ if (process.argv[2] === 'child') { }); } else { - const child = fork(__filename, ['child'], {silent: true}); + const child = fork(__filename, ['child'], { silent: true }); const ipc = []; let stdout = ''; diff --git a/test/parallel/test-child-process-fork-stdio-string-variant.js b/test/parallel/test-child-process-fork-stdio-string-variant.js index 5c69850216..c1458512b2 100644 --- a/test/parallel/test-child-process-fork-stdio-string-variant.js +++ b/test/parallel/test-child-process-fork-stdio-string-variant.js @@ -10,16 +10,16 @@ const fork = require('child_process').fork; const childScript = `${common.fixturesDir}/child-process-spawn-node`; const errorRegexp = /^TypeError: Incorrect value of stdio option:/; -const malFormedOpts = {stdio: '33'}; -const payload = {hello: 'world'}; +const malFormedOpts = { stdio: '33' }; +const payload = { hello: 'world' }; assert.throws(() => fork(childScript, malFormedOpts), errorRegexp); function test(stringVariant) { - const child = fork(childScript, {stdio: stringVariant}); + const child = fork(childScript, { stdio: stringVariant }); child.on('message', common.mustCall((message) => { - assert.deepStrictEqual(message, {foo: 'bar'}); + assert.deepStrictEqual(message, { foo: 'bar' }); })); child.send(payload); diff --git a/test/parallel/test-child-process-fork-stdio.js b/test/parallel/test-child-process-fork-stdio.js index 89a5ff98e5..be0bdf19c3 100644 --- a/test/parallel/test-child-process-fork-stdio.js +++ b/test/parallel/test-child-process-fork-stdio.js @@ -20,7 +20,7 @@ if (process.argv[2] === 'child') { }); } else { assert.throws(() => { - cp.fork(__filename, {stdio: ['pipe', 'pipe', 'pipe', 'pipe']}); + cp.fork(__filename, { stdio: ['pipe', 'pipe', 'pipe', 'pipe'] }); }, /Forked processes must have an IPC channel/); let ipc = ''; diff --git a/test/parallel/test-child-process-internal.js b/test/parallel/test-child-process-internal.js index 0056d4215b..4b22b40603 100644 --- a/test/parallel/test-child-process-internal.js +++ b/test/parallel/test-child-process-internal.js @@ -25,8 +25,8 @@ const assert = require('assert'); //messages const PREFIX = 'NODE_'; -const normal = {cmd: `foo${PREFIX}`}; -const internal = {cmd: `${PREFIX}bar`}; +const normal = { cmd: `foo${PREFIX}` }; +const internal = { cmd: `${PREFIX}bar` }; if (process.argv[2] === 'child') { //send non-internal message containing PREFIX at a non prefix position diff --git a/test/parallel/test-child-process-send-keep-open.js b/test/parallel/test-child-process-send-keep-open.js index 1ce7d38282..2d8a28121a 100644 --- a/test/parallel/test-child-process-send-keep-open.js +++ b/test/parallel/test-child-process-send-keep-open.js @@ -32,7 +32,7 @@ if (process.argv[2] !== 'child') { }); })); - child.send('socket', socket, {keepOpen: true}, common.mustCall((err) => { + child.send('socket', socket, { keepOpen: true }, common.mustCall((err) => { assert.ifError(err); })); }); diff --git a/test/parallel/test-child-process-send-type-error.js b/test/parallel/test-child-process-send-type-error.js index 00263a5d21..29dd45f6bd 100644 --- a/test/parallel/test-child-process-send-type-error.js +++ b/test/parallel/test-child-process-send-type-error.js @@ -7,7 +7,7 @@ const cp = require('child_process'); function fail(proc, args) { assert.throws(() => { proc.send.apply(proc, args); - }, common.expectsError({code: 'ERR_INVALID_ARG_TYPE', type: TypeError})); + }, common.expectsError({ code: 'ERR_INVALID_ARG_TYPE', type: TypeError })); } let target = process; diff --git a/test/parallel/test-child-process-silent.js b/test/parallel/test-child-process-silent.js index bd61770cde..b280e10181 100644 --- a/test/parallel/test-child-process-silent.js +++ b/test/parallel/test-child-process-silent.js @@ -39,7 +39,7 @@ if (process.argv[2] === 'pipe') { } else if (process.argv[2] === 'parent') { // Parent | start child pipe test - const child = childProcess.fork(process.argv[1], ['pipe'], {silent: true}); + const child = childProcess.fork(process.argv[1], ['pipe'], { silent: true }); // Allow child process to self terminate child.channel.close(); @@ -67,11 +67,11 @@ if (process.argv[2] === 'pipe') { }); // testing: do message system work when using silent - const child = childProcess.fork(process.argv[1], ['ipc'], {silent: true}); + const child = childProcess.fork(process.argv[1], ['ipc'], { silent: true }); // Manual pipe so we will get errors - child.stderr.pipe(process.stderr, {end: false}); - child.stdout.pipe(process.stdout, {end: false}); + child.stderr.pipe(process.stderr, { end: false }); + child.stdout.pipe(process.stdout, { end: false }); let childSending = false; let childReciveing = false; diff --git a/test/parallel/test-child-process-spawn-argv0.js b/test/parallel/test-child-process-spawn-argv0.js index 593ba9e48c..1ee1c2f64f 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-spawn-shell.js b/test/parallel/test-child-process-spawn-shell.js index e9dd0e07ef..e9a753e91a 100644 --- a/test/parallel/test-child-process-spawn-shell.js +++ b/test/parallel/test-child-process-spawn-shell.js @@ -4,7 +4,7 @@ const assert = require('assert'); const cp = require('child_process'); // Verify that a shell is, in fact, executed -const doesNotExist = cp.spawn('does-not-exist', {shell: true}); +const doesNotExist = cp.spawn('does-not-exist', { shell: true }); assert.notStrictEqual(doesNotExist.spawnfile, 'does-not-exist'); doesNotExist.on('error', common.mustNotCall()); @@ -50,7 +50,7 @@ command.on('close', common.mustCall((code, signal) => { // Verify that the environment is properly inherited const env = cp.spawn(`"${process.execPath}" -pe process.env.BAZ`, { - env: Object.assign({}, process.env, {BAZ: 'buzz'}), + env: Object.assign({}, process.env, { BAZ: 'buzz' }), encoding: 'utf8', shell: true }); diff --git a/test/parallel/test-child-process-spawnsync-kill-signal.js b/test/parallel/test-child-process-spawnsync-kill-signal.js index 73063e7f38..c9f601a0ca 100644 --- a/test/parallel/test-child-process-spawnsync-kill-signal.js +++ b/test/parallel/test-child-process-spawnsync-kill-signal.js @@ -20,7 +20,7 @@ if (process.argv[2] === 'child') { } const child = cp.spawnSync(process.execPath, [__filename, 'child'], - {killSignal, timeout: 100}); + { killSignal, timeout: 100 }); if (beforeSpawn) internalCp.spawnSync = oldSpawnSync; assert.strictEqual(child.status, null); diff --git a/test/parallel/test-child-process-spawnsync-shell.js b/test/parallel/test-child-process-spawnsync-shell.js index ed66d79332..f0838ae116 100644 --- a/test/parallel/test-child-process-spawnsync-shell.js +++ b/test/parallel/test-child-process-spawnsync-shell.js @@ -7,7 +7,7 @@ const internalCp = require('internal/child_process'); const oldSpawnSync = internalCp.spawnSync; // Verify that a shell is, in fact, executed -const doesNotExist = cp.spawnSync('does-not-exist', {shell: true}); +const doesNotExist = cp.spawnSync('does-not-exist', { shell: true }); assert.notStrictEqual(doesNotExist.file, 'does-not-exist'); assert.strictEqual(doesNotExist.error, undefined); @@ -24,20 +24,20 @@ internalCp.spawnSync = common.mustCall(function(opts) { 'echo foo'); return oldSpawnSync(opts); }); -const echo = cp.spawnSync('echo', ['foo'], {shell: true}); +const echo = cp.spawnSync('echo', ['foo'], { shell: true }); internalCp.spawnSync = oldSpawnSync; assert.strictEqual(echo.stdout.toString().trim(), 'foo'); // Verify that shell features can be used const cmd = 'echo bar | cat'; -const command = cp.spawnSync(cmd, {shell: true}); +const command = cp.spawnSync(cmd, { shell: true }); assert.strictEqual(command.stdout.toString().trim(), 'bar'); // Verify that the environment is properly inherited const env = cp.spawnSync(`"${process.execPath}" -pe process.env.BAZ`, { - env: Object.assign({}, process.env, {BAZ: 'buzz'}), + env: Object.assign({}, process.env, { BAZ: 'buzz' }), shell: true }); diff --git a/test/parallel/test-child-process-spawnsync-timeout.js b/test/parallel/test-child-process-spawnsync-timeout.js index e2f59acaeb..7888822535 100644 --- a/test/parallel/test-child-process-spawnsync-timeout.js +++ b/test/parallel/test-child-process-spawnsync-timeout.js @@ -38,7 +38,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-child-process-spawnsync.js b/test/parallel/test-child-process-spawnsync.js index 0d0a3dba56..7b768d8403 100644 --- a/test/parallel/test-child-process-spawnsync.js +++ b/test/parallel/test-child-process-spawnsync.js @@ -42,7 +42,7 @@ assert.deepStrictEqual(ret_err.spawnargs, ['bar']); { // Test the cwd option const cwd = common.rootDir; - const response = common.spawnSyncPwd({cwd}); + const response = common.spawnSyncPwd({ cwd }); assert.strictEqual(response.stdout.toString().trim(), cwd); } @@ -50,8 +50,8 @@ assert.deepStrictEqual(ret_err.spawnargs, ['bar']); { // Test the encoding option const noEncoding = common.spawnSyncPwd(); - const bufferEncoding = common.spawnSyncPwd({encoding: 'buffer'}); - const utf8Encoding = common.spawnSyncPwd({encoding: 'utf8'}); + const bufferEncoding = common.spawnSyncPwd({ encoding: 'buffer' }); + const utf8Encoding = common.spawnSyncPwd({ encoding: 'utf8' }); assert.deepStrictEqual(noEncoding.output, bufferEncoding.output); assert.deepStrictEqual([ diff --git a/test/parallel/test-child-process-stdio.js b/test/parallel/test-child-process-stdio.js index eda2d8841a..f1d18d437f 100644 --- a/test/parallel/test-child-process-stdio.js +++ b/test/parallel/test-child-process-stdio.js @@ -24,22 +24,22 @@ const common = require('../common'); const assert = require('assert'); const spawnSync = require('child_process').spawnSync; -let options = {stdio: ['pipe']}; +let options = { stdio: ['pipe'] }; let child = common.spawnPwd(options); assert.notStrictEqual(child.stdout, null); assert.notStrictEqual(child.stderr, null); -options = {stdio: 'ignore'}; +options = { stdio: 'ignore' }; child = common.spawnPwd(options); assert.strictEqual(child.stdout, null); assert.strictEqual(child.stderr, null); -options = {stdio: 'ignore'}; +options = { stdio: 'ignore' }; child = spawnSync('cat', [], options); -assert.deepStrictEqual(options, {stdio: 'ignore'}); +assert.deepStrictEqual(options, { stdio: 'ignore' }); assert.throws(() => { - common.spawnPwd({stdio: ['pipe', 'pipe', 'pipe', 'ipc', 'ipc']}); -}, common.expectsError({code: 'ERR_IPC_ONE_PIPE', type: Error})); + common.spawnPwd({ stdio: ['pipe', 'pipe', 'pipe', 'ipc', 'ipc'] }); +}, common.expectsError({ code: 'ERR_IPC_ONE_PIPE', type: Error })); diff --git a/test/parallel/test-child-process-uid-gid.js b/test/parallel/test-child-process-uid-gid.js index ec2cb9a319..621884cea6 100644 --- a/test/parallel/test-child-process-uid-gid.js +++ b/test/parallel/test-child-process-uid-gid.js @@ -6,12 +6,12 @@ const expectedError = common.isWindows ? /\bENOTSUP\b/ : /\bEPERM\b/; if (common.isWindows || process.getuid() !== 0) { assert.throws(() => { - spawn('echo', ['fhqwhgads'], {uid: 0}); + spawn('echo', ['fhqwhgads'], { uid: 0 }); }, expectedError); } if (common.isWindows || !process.getgroups().some((gid) => gid === 0)) { assert.throws(() => { - spawn('echo', ['fhqwhgads'], {gid: 0}); + spawn('echo', ['fhqwhgads'], { gid: 0 }); }, expectedError); } diff --git a/test/parallel/test-child-process-validate-stdio.js b/test/parallel/test-child-process-validate-stdio.js index 43f7d02c9b..129ca9822a 100644 --- a/test/parallel/test-child-process-validate-stdio.js +++ b/test/parallel/test-child-process-validate-stdio.js @@ -6,7 +6,7 @@ const assert = require('assert'); const _validateStdio = require('internal/child_process')._validateStdio; const expectedError = - common.expectsError({code: 'ERR_INVALID_OPT_VALUE', type: TypeError}, 2); + common.expectsError({ code: 'ERR_INVALID_OPT_VALUE', type: TypeError }, 2); // should throw if string and not ignore, pipe, or inherit assert.throws(() => _validateStdio('foo'), expectedError); @@ -27,7 +27,7 @@ assert.throws(() => _validateStdio(600), expectedError); // should throw if stdio has ipc and sync is true const stdio2 = ['ipc', 'ipc', 'ipc']; assert.throws(() => _validateStdio(stdio2, true), - common.expectsError({code: 'ERR_IPC_SYNC_FORK', type: Error})); + common.expectsError({ code: 'ERR_IPC_SYNC_FORK', type: Error })); { const stdio3 = [process.stdin, process.stdout, process.stderr]; diff --git a/test/parallel/test-cli-bad-options.js b/test/parallel/test-cli-bad-options.js index 15a385b99f..ebc434670e 100644 --- a/test/parallel/test-cli-bad-options.js +++ b/test/parallel/test-cli-bad-options.js @@ -13,7 +13,7 @@ requiresArgument('--debug-port='); requiresArgument('--eval'); function requiresArgument(option) { - const r = spawn(process.execPath, [option], {encoding: 'utf8'}); + const r = spawn(process.execPath, [option], { encoding: 'utf8' }); assert.strictEqual(r.status, 9); diff --git a/test/parallel/test-cli-node-options.js b/test/parallel/test-cli-node-options.js index 83b387fa04..eb31e280c3 100644 --- a/test/parallel/test-cli-node-options.js +++ b/test/parallel/test-cli-node-options.js @@ -29,7 +29,7 @@ disallow('--'); disallow('--no_warnings'); // Node options don't allow '_' instead of '-'. function disallow(opt) { - const options = {env: {NODE_OPTIONS: opt}}; + const options = { env: { NODE_OPTIONS: opt } }; exec(process.execPath, options, common.mustCall(function(err) { const message = err.message.split(/\r?\n/)[1]; const expect = `${process.execPath}: ${opt} is not allowed in NODE_OPTIONS`; @@ -71,7 +71,7 @@ function expect(opt, want) { const printB = require.resolve('../fixtures/printB.js'); const argv = [printB]; const opts = { - env: {NODE_OPTIONS: opt}, + env: { NODE_OPTIONS: opt }, maxBuffer: 1000000000, }; exec(process.execPath, argv, opts, common.mustCall(function(err, stdout) { diff --git a/test/parallel/test-cli-syntax.js b/test/parallel/test-cli-syntax.js index 8ccc3fe017..be44ac3d38 100644 --- a/test/parallel/test-cli-syntax.js +++ b/test/parallel/test-cli-syntax.js @@ -2,7 +2,7 @@ const common = require('../common'); const assert = require('assert'); -const {exec, spawnSync} = require('child_process'); +const { exec, spawnSync } = require('child_process'); const path = require('path'); const node = process.execPath; @@ -95,7 +95,7 @@ const notFoundRE = /^Error: Cannot find module/m; // loop each possible option, `-c` or `--check` syntaxArgs.forEach(function(args) { const stdin = 'throw new Error("should not get run");'; - const c = spawnSync(node, args, {encoding: 'utf8', input: stdin}); + const c = spawnSync(node, args, { encoding: 'utf8', input: stdin }); // no stdout or stderr should be produced assert.strictEqual(c.stdout, '', 'stdout produced'); @@ -108,7 +108,7 @@ syntaxArgs.forEach(function(args) { // loop each possible option, `-c` or `--check` syntaxArgs.forEach(function(args) { const stdin = 'var foo bar;'; - const c = spawnSync(node, args, {encoding: 'utf8', input: stdin}); + const c = spawnSync(node, args, { encoding: 'utf8', input: stdin }); // stderr should include '[stdin]' as the filename assert(c.stderr.startsWith('[stdin]'), "stderr doesn't start with [stdin]"); diff --git a/test/parallel/test-cluster-bind-twice.js b/test/parallel/test-cluster-bind-twice.js index 1fde246525..4ef319ae80 100644 --- a/test/parallel/test-cluster-bind-twice.js +++ b/test/parallel/test-cluster-bind-twice.js @@ -68,7 +68,7 @@ if (!id) { a.on('message', common.mustCall((m) => { assert.strictEqual(m.msg, 'READY'); - b.send({msg: 'START', port: m.port}); + b.send({ msg: 'START', port: m.port }); })); b.on('message', common.mustCall((m) => { @@ -82,7 +82,7 @@ if (!id) { const server = http.createServer(common.mustNotCall()); server.listen(0, common.mustCall(() => { - process.send({msg: 'READY', port: server.address().port}); + process.send({ msg: 'READY', port: server.address().port }); })); process.on('message', common.mustCall((m) => { diff --git a/test/parallel/test-cluster-dgram-1.js b/test/parallel/test-cluster-dgram-1.js index 3688c67f6c..5de04b3b7c 100644 --- a/test/parallel/test-cluster-dgram-1.js +++ b/test/parallel/test-cluster-dgram-1.js @@ -102,7 +102,7 @@ function worker() { // Every 10 messages, notify the master. if (received === PACKETS_PER_WORKER) { - process.send({received: received}); + process.send({ received: received }); socket.close(); } }, PACKETS_PER_WORKER)); diff --git a/test/parallel/test-cluster-disconnect-unshared-tcp.js b/test/parallel/test-cluster-disconnect-unshared-tcp.js index 584881f05f..59df0c5479 100644 --- a/test/parallel/test-cluster-disconnect-unshared-tcp.js +++ b/test/parallel/test-cluster-disconnect-unshared-tcp.js @@ -30,7 +30,7 @@ if (cluster.isMaster) { const unbound = cluster.fork().on('online', bind); function bind() { - cluster.fork({BOUND: 'y'}).on('listening', disconnect); + cluster.fork({ BOUND: 'y' }).on('listening', disconnect); } function disconnect() { diff --git a/test/parallel/test-cluster-disconnect-unshared-udp.js b/test/parallel/test-cluster-disconnect-unshared-udp.js index d34ce11b02..b0670f3e32 100644 --- a/test/parallel/test-cluster-disconnect-unshared-udp.js +++ b/test/parallel/test-cluster-disconnect-unshared-udp.js @@ -33,7 +33,7 @@ if (cluster.isMaster) { const unbound = cluster.fork().on('online', bind); function bind() { - cluster.fork({BOUND: 'y'}).on('listening', disconnect); + cluster.fork({ BOUND: 'y' }).on('listening', disconnect); } function disconnect() { diff --git a/test/parallel/test-cluster-eaccess.js b/test/parallel/test-cluster-eaccess.js index c7bb46b284..ecf0862fa3 100644 --- a/test/parallel/test-cluster-eaccess.js +++ b/test/parallel/test-cluster-eaccess.js @@ -35,7 +35,7 @@ if (cluster.isMaster && process.argv.length !== 3) { // cluster.isMaster common.refreshTmpDir(); const PIPE_NAME = common.PIPE; - const worker = cluster.fork({PIPE_NAME}); + const worker = cluster.fork({ PIPE_NAME }); // makes sure master is able to fork the worker cluster.on('fork', common.mustCall()); diff --git a/test/parallel/test-cluster-ipc-throw.js b/test/parallel/test-cluster-ipc-throw.js index 95c5d84ea6..d19cf0c381 100644 --- a/test/parallel/test-cluster-ipc-throw.js +++ b/test/parallel/test-cluster-ipc-throw.js @@ -9,8 +9,8 @@ cluster.schedulingPolicy = cluster.SCHED_RR; const server = http.createServer(); if (cluster.isMaster) { - server.listen({port: 0}, common.mustCall(() => { - const worker = cluster.fork({PORT: server.address().port}); + server.listen({ port: 0 }, common.mustCall(() => { + const worker = cluster.fork({ PORT: server.address().port }); worker.on('exit', common.mustCall(() => { server.close(); })); diff --git a/test/parallel/test-cluster-master-error.js b/test/parallel/test-cluster-master-error.js index cc104ec441..9abb42e422 100644 --- a/test/parallel/test-cluster-master-error.js +++ b/test/parallel/test-cluster-master-error.js @@ -84,7 +84,7 @@ if (cluster.isWorker) { const workers = []; // Spawn a cluster process - const master = fork(process.argv[1], ['cluster'], {silent: true}); + const master = fork(process.argv[1], ['cluster'], { silent: true }); // Handle messages from the cluster master.on('message', common.mustCall((data) => { diff --git a/test/parallel/test-cluster-send-deadlock.js b/test/parallel/test-cluster-send-deadlock.js index 9ae0f4a119..da503f67aa 100644 --- a/test/parallel/test-cluster-send-deadlock.js +++ b/test/parallel/test-cluster-send-deadlock.js @@ -41,7 +41,7 @@ if (cluster.isMaster) { }); server.listen(0, function() { - worker.send({message: 'listen', port: server.address().port}); + worker.send({ message: 'listen', port: server.address().port }); }); } else { process.on('message', function(msg, handle) { diff --git a/test/parallel/test-cluster-shared-handle-bind-error.js b/test/parallel/test-cluster-shared-handle-bind-error.js index c58b6ed7d9..1ce7a573cf 100644 --- a/test/parallel/test-cluster-shared-handle-bind-error.js +++ b/test/parallel/test-cluster-shared-handle-bind-error.js @@ -32,7 +32,7 @@ if (cluster.isMaster) { const server = net.createServer(common.mustNotCall()); server.listen(0, common.mustCall(() => { - const worker = cluster.fork({PORT: server.address().port}); + const worker = cluster.fork({ PORT: server.address().port }); worker.on('exit', common.mustCall((exitCode) => { assert.strictEqual(exitCode, 0); server.close(); diff --git a/test/parallel/test-cluster-worker-constructor.js b/test/parallel/test-cluster-worker-constructor.js index 06a1ad774c..c116e622e5 100644 --- a/test/parallel/test-cluster-worker-constructor.js +++ b/test/parallel/test-cluster-worker-constructor.js @@ -44,6 +44,6 @@ assert.strictEqual(worker.state, 'online'); assert.strictEqual(worker.id, 3); assert.strictEqual(worker.process, process); -worker = cluster.Worker.call({}, {id: 5}); +worker = cluster.Worker.call({}, { id: 5 }); assert(worker instanceof cluster.Worker); assert.strictEqual(worker.id, 5); diff --git a/test/parallel/test-cluster-worker-disconnect-on-error.js b/test/parallel/test-cluster-worker-disconnect-on-error.js index 70d6a4df2a..c55e69e256 100644 --- a/test/parallel/test-cluster-worker-disconnect-on-error.js +++ b/test/parallel/test-cluster-worker-disconnect-on-error.js @@ -14,7 +14,7 @@ if (cluster.isMaster) { assert.ifError(error); assert(worker); - worker.send({port: server.address().port}); + worker.send({ port: server.address().port }); })); worker = cluster.fork(); diff --git a/test/parallel/test-cluster-worker-no-exit.js b/test/parallel/test-cluster-worker-no-exit.js index 7dbe9fcb37..490000aeb6 100644 --- a/test/parallel/test-cluster-worker-no-exit.js +++ b/test/parallel/test-cluster-worker-no-exit.js @@ -60,7 +60,7 @@ if (cluster.isMaster) { worker = cluster.fork() .on('online', function() { - this.send({port: port}); + this.send({ port: port }); }); }); process.on('exit', function() { diff --git a/test/parallel/test-common.js b/test/parallel/test-common.js index 819cd81553..7fee3e0b84 100644 --- a/test/parallel/test-common.js +++ b/test/parallel/test-common.js @@ -22,8 +22,8 @@ 'use strict'; const common = require('../common'); const assert = require('assert'); -const {join} = require('path'); -const {execFile} = require('child_process'); +const { join } = require('path'); +const { execFile } = require('child_process'); // test for leaked global detection global.gc = 42; // Not a valid global unless --expose_gc is set. diff --git a/test/parallel/test-console.js b/test/parallel/test-console.js index 0fcb765f20..bca70467c0 100644 --- a/test/parallel/test-console.js +++ b/test/parallel/test-console.js @@ -58,28 +58,28 @@ common.hijackStderr(function(data) { console.log('foo'); console.log('foo', 'bar'); console.log('%s %s', 'foo', 'bar', 'hop'); -console.log({slashes: '\\\\'}); +console.log({ slashes: '\\\\' }); console.log(custom_inspect); // test console.info() goes to stdout console.info('foo'); console.info('foo', 'bar'); console.info('%s %s', 'foo', 'bar', 'hop'); -console.info({slashes: '\\\\'}); +console.info({ slashes: '\\\\' }); console.info(custom_inspect); // test console.error() goes to stderr console.error('foo'); console.error('foo', 'bar'); console.error('%s %s', 'foo', 'bar', 'hop'); -console.error({slashes: '\\\\'}); +console.error({ slashes: '\\\\' }); console.error(custom_inspect); // test console.warn() goes to stderr console.warn('foo'); console.warn('foo', 'bar'); console.warn('%s %s', 'foo', 'bar', 'hop'); -console.warn({slashes: '\\\\'}); +console.warn({ slashes: '\\\\' }); console.warn(custom_inspect); // test console.dir() diff --git a/test/parallel/test-crypto-binary-default.js b/test/parallel/test-crypto-binary-default.js index 5bb254057b..4a31f76865 100644 --- a/test/parallel/test-crypto-binary-default.js +++ b/test/parallel/test-crypto-binary-default.js @@ -48,19 +48,19 @@ const rsaKeyPem = fs.readFileSync(`${fixtDir}/test_rsa_privkey.pem`, 'ascii'); // PFX tests assert.doesNotThrow(function() { - tls.createSecureContext({pfx: certPfx, passphrase: 'sample'}); + tls.createSecureContext({ pfx: certPfx, passphrase: 'sample' }); }); assert.throws(function() { - tls.createSecureContext({pfx: certPfx}); + tls.createSecureContext({ pfx: certPfx }); }, /^Error: mac verify failure$/); assert.throws(function() { - tls.createSecureContext({pfx: certPfx, passphrase: 'test'}); + tls.createSecureContext({ pfx: certPfx, passphrase: 'test' }); }, /^Error: mac verify failure$/); assert.throws(function() { - tls.createSecureContext({pfx: 'sample', passphrase: 'test'}); + tls.createSecureContext({ pfx: 'sample', passphrase: 'test' }); }, /^Error: not enough data$/); // Test HMAC @@ -549,7 +549,7 @@ testCipher4(Buffer.from('0123456789abcd0123456789'), Buffer.from('12345678')); // update() should only take buffers / strings assert.throws(function() { - crypto.createHash('sha1').update({foo: 'bar'}); + crypto.createHash('sha1').update({ foo: 'bar' }); }, /^TypeError: Data must be a string or a buffer$/); diff --git a/test/parallel/test-crypto.js b/test/parallel/test-crypto.js index d45de9979b..41d0820fce 100644 --- a/test/parallel/test-crypto.js +++ b/test/parallel/test-crypto.js @@ -41,7 +41,7 @@ const keyPem = fs.readFileSync(`${common.fixturesDir}/test_key.pem`, 'ascii'); // 'this' safety // https://github.com/joyent/node/issues/6690 assert.throws(function() { - const options = {key: keyPem, cert: certPem, ca: caPem}; + const options = { key: keyPem, cert: certPem, ca: caPem }; const credentials = tls.createSecureContext(options); const context = credentials.context; const notcontext = { setOptions: context.setOptions, setKey: context.setKey }; @@ -50,25 +50,25 @@ assert.throws(function() { // PFX tests assert.doesNotThrow(function() { - tls.createSecureContext({pfx: certPfx, passphrase: 'sample'}); + tls.createSecureContext({ pfx: certPfx, passphrase: 'sample' }); }); assert.throws(function() { - tls.createSecureContext({pfx: certPfx}); + tls.createSecureContext({ pfx: certPfx }); }, /^Error: mac verify failure$/); assert.throws(function() { - tls.createSecureContext({pfx: certPfx, passphrase: 'test'}); + tls.createSecureContext({ pfx: certPfx, passphrase: 'test' }); }, /^Error: mac verify failure$/); assert.throws(function() { - tls.createSecureContext({pfx: 'sample', passphrase: 'test'}); + tls.createSecureContext({ pfx: 'sample', passphrase: 'test' }); }, /^Error: not enough data$/); // update() should only take buffers / strings assert.throws(function() { - crypto.createHash('sha1').update({foo: 'bar'}); + crypto.createHash('sha1').update({ foo: 'bar' }); }, /^TypeError: Data must be a string or a buffer$/); diff --git a/test/parallel/test-dgram-exclusive-implicit-bind.js b/test/parallel/test-dgram-exclusive-implicit-bind.js index de7137d964..171b221ee2 100644 --- a/test/parallel/test-dgram-exclusive-implicit-bind.js +++ b/test/parallel/test-dgram-exclusive-implicit-bind.js @@ -70,15 +70,15 @@ if (cluster.isMaster) { }); target.on('listening', function() { - cluster.fork({PORT: target.address().port}); - cluster.fork({PORT: target.address().port}); + cluster.fork({ PORT: target.address().port }); + cluster.fork({ PORT: target.address().port }); if (!common.isWindows) { - cluster.fork({BOUND: 'y', PORT: target.address().port}); - cluster.fork({BOUND: 'y', PORT: target.address().port}); + cluster.fork({ BOUND: 'y', PORT: target.address().port }); + cluster.fork({ BOUND: 'y', PORT: target.address().port }); } }); - target.bind({port: 0, exclusive: true}); + target.bind({ port: 0, exclusive: true }); return; } diff --git a/test/parallel/test-dgram-membership.js b/test/parallel/test-dgram-membership.js index 586db5f3cf..183faca1a4 100644 --- a/test/parallel/test-dgram-membership.js +++ b/test/parallel/test-dgram-membership.js @@ -5,7 +5,7 @@ const assert = require('assert'); const dgram = require('dgram'); const multicastAddress = '224.0.0.114'; -const setup = dgram.createSocket.bind(dgram, {type: 'udp4', reuseAddr: true}); +const setup = dgram.createSocket.bind(dgram, { type: 'udp4', reuseAddr: true }); // addMembership() on closed socket should throw { diff --git a/test/parallel/test-dns.js b/test/parallel/test-dns.js index 175ac10298..8041587677 100644 --- a/test/parallel/test-dns.js +++ b/test/parallel/test-dns.js @@ -164,7 +164,7 @@ assert.throws(() => dns.lookup('nodejs.org'), assert.throws(() => dns.lookup('nodejs.org', 4), /^TypeError: Invalid arguments: callback must be passed$/); -assert.doesNotThrow(() => dns.lookup('', {family: 4, hints: 0}, +assert.doesNotThrow(() => dns.lookup('', { family: 4, hints: 0 }, common.mustCall())); assert.doesNotThrow(() => { @@ -174,7 +174,7 @@ assert.doesNotThrow(() => { }, common.mustCall()); }); -assert.doesNotThrow(() => dns.lookup('', {hints: dns.V4MAPPED}, +assert.doesNotThrow(() => dns.lookup('', { hints: dns.V4MAPPED }, common.mustCall())); assert.doesNotThrow(() => { diff --git a/test/parallel/test-domain-http-server.js b/test/parallel/test-domain-http-server.js index 98e15a8437..99000563eb 100644 --- a/test/parallel/test-domain-http-server.js +++ b/test/parallel/test-domain-http-server.js @@ -41,7 +41,7 @@ const server = http.createServer(function(req, res) { serverCaught++; console.log('horray! got a server error', er); // try to send a 500. If that fails, oh well. - res.writeHead(500, {'content-type': 'text/plain'}); + res.writeHead(500, { 'content-type': 'text/plain' }); res.end(er.stack || er.message || 'Unknown error'); }); diff --git a/test/parallel/test-domain-top-level-error-handler-throw.js b/test/parallel/test-domain-top-level-error-handler-throw.js index 86df8db5b7..3a07683273 100644 --- a/test/parallel/test-domain-top-level-error-handler-throw.js +++ b/test/parallel/test-domain-top-level-error-handler-throw.js @@ -29,7 +29,7 @@ if (process.argv[2] === 'child') { const fork = require('child_process').fork; const assert = require('assert'); - const child = fork(process.argv[1], ['child'], {silent: true}); + const child = fork(process.argv[1], ['child'], { silent: true }); let stderrOutput = ''; if (child) { child.stderr.on('data', function onStderrData(data) { diff --git a/test/parallel/test-event-emitter-errors.js b/test/parallel/test-event-emitter-errors.js index be4f4007f0..d52d3b4f4e 100644 --- a/test/parallel/test-event-emitter-errors.js +++ b/test/parallel/test-event-emitter-errors.js @@ -10,5 +10,5 @@ assert.throws(() => { }, /^Error: Unhandled "error" event\. \(Accepts a string\)$/); assert.throws(() => { - EE.emit('error', {message: 'Error!'}); + EE.emit('error', { message: 'Error!' }); }, /^Error: Unhandled "error" event\. \(\[object Object\]\)$/); diff --git a/test/parallel/test-fs-open-flags.js b/test/parallel/test-fs-open-flags.js index 76fd74736b..8f68b407df 100644 --- a/test/parallel/test-fs-open-flags.js +++ b/test/parallel/test-fs-open-flags.js @@ -56,7 +56,7 @@ assert.strictEqual(stringToFlags('ax+'), O_APPEND | O_CREAT | O_RDWR | O_EXCL); assert.strictEqual(stringToFlags('xa+'), O_APPEND | O_CREAT | O_RDWR | O_EXCL); const expectedError = - common.expectsError({code: 'ERR_INVALID_OPT_VALUE', type: TypeError}, 23); + common.expectsError({ code: 'ERR_INVALID_OPT_VALUE', type: TypeError }, 23); ('+ +a +r +w rw wa war raw r++ a++ w++ x +x x+ rx rx+ wxx wax xwx xxx') .split(' ') diff --git a/test/parallel/test-fs-read-stream-inherit.js b/test/parallel/test-fs-read-stream-inherit.js index 8b1ca06950..ddb07274d1 100644 --- a/test/parallel/test-fs-read-stream-inherit.js +++ b/test/parallel/test-fs-read-stream-inherit.js @@ -49,7 +49,7 @@ const rangeFile = path.join(common.fixturesDir, 'x.txt'); } { - const file = fs.createReadStream(fn, Object.create({encoding: 'utf8'})); + const file = fs.createReadStream(fn, Object.create({ encoding: 'utf8' })); file.length = 0; file.on('data', function(data) { assert.strictEqual(typeof data, 'string'); @@ -67,7 +67,7 @@ const rangeFile = path.join(common.fixturesDir, 'x.txt'); } { - const options = Object.create({bufferSize: 1, start: 1, end: 2}); + const options = Object.create({ bufferSize: 1, start: 1, end: 2 }); const file = fs.createReadStream(rangeFile, options); assert.strictEqual(file.start, 1); assert.strictEqual(file.end, 2); @@ -81,7 +81,7 @@ const rangeFile = path.join(common.fixturesDir, 'x.txt'); } { - const options = Object.create({bufferSize: 1, start: 1}); + const options = Object.create({ bufferSize: 1, start: 1 }); const file = fs.createReadStream(rangeFile, options); assert.strictEqual(file.start, 1); file.data = ''; @@ -95,7 +95,7 @@ const rangeFile = path.join(common.fixturesDir, 'x.txt'); // https://github.com/joyent/node/issues/2320 { - const options = Object.create({bufferSize: 1.23, start: 1}); + const options = Object.create({ bufferSize: 1.23, start: 1 }); const file = fs.createReadStream(rangeFile, options); assert.strictEqual(file.start, 1); file.data = ''; @@ -109,12 +109,12 @@ const rangeFile = path.join(common.fixturesDir, 'x.txt'); { assert.throws(function() { - fs.createReadStream(rangeFile, Object.create({start: 10, end: 2})); + fs.createReadStream(rangeFile, Object.create({ start: 10, end: 2 })); }, /"start" option must be <= "end" option/); } { - const options = Object.create({start: 0, end: 0}); + const options = Object.create({ start: 0, end: 0 }); const stream = fs.createReadStream(rangeFile, options); assert.strictEqual(stream.start, 0); assert.strictEqual(stream.end, 0); @@ -139,7 +139,7 @@ const rangeFile = path.join(common.fixturesDir, 'x.txt'); { let data = ''; let file = - fs.createReadStream(rangeFile, Object.create({autoClose: false })); + fs.createReadStream(rangeFile, Object.create({ autoClose: false })); assert.strictEqual(file.autoClose, false); file.on('data', (chunk) => { data += chunk; }); file.on('end', common.mustCall(function() { @@ -153,7 +153,7 @@ const rangeFile = path.join(common.fixturesDir, 'x.txt'); function fileNext() { // This will tell us if the fd is usable again or not. - file = fs.createReadStream(null, Object.create({fd: file.fd, start: 0 })); + file = fs.createReadStream(null, Object.create({ fd: file.fd, start: 0 })); file.data = ''; file.on('data', function(data) { file.data += data; @@ -170,7 +170,7 @@ const rangeFile = path.join(common.fixturesDir, 'x.txt'); // Just to make sure autoClose won't close the stream because of error. { - const options = Object.create({fd: 13337, autoClose: false}); + const options = Object.create({ fd: 13337, autoClose: false }); const file = fs.createReadStream(null, options); file.on('data', common.mustNotCall()); file.on('error', common.mustCall()); diff --git a/test/parallel/test-fs-read-stream-throw-type-error.js b/test/parallel/test-fs-read-stream-throw-type-error.js index 6e4f405daa..b6e1869fdc 100644 --- a/test/parallel/test-fs-read-stream-throw-type-error.js +++ b/test/parallel/test-fs-read-stream-throw-type-error.js @@ -16,7 +16,7 @@ assert.doesNotThrow(function() { fs.createReadStream(example, 'utf8'); }); assert.doesNotThrow(function() { - fs.createReadStream(example, {encoding: 'utf8'}); + fs.createReadStream(example, { encoding: 'utf8' }); }); const errMessage = /"options" must be a string or an object/; diff --git a/test/parallel/test-fs-read-stream.js b/test/parallel/test-fs-read-stream.js index 9ec397c31e..1558ce1ee5 100644 --- a/test/parallel/test-fs-read-stream.js +++ b/test/parallel/test-fs-read-stream.js @@ -86,7 +86,7 @@ const rangeFile = path.join(common.fixturesDir, 'x.txt'); } { - const file = fs.createReadStream(fn, {encoding: 'utf8'}); + const file = fs.createReadStream(fn, { encoding: 'utf8' }); file.length = 0; file.on('data', function(data) { assert.strictEqual('string', typeof data); @@ -107,7 +107,7 @@ const rangeFile = path.join(common.fixturesDir, 'x.txt'); { const file = - fs.createReadStream(rangeFile, {bufferSize: 1, start: 1, end: 2}); + fs.createReadStream(rangeFile, { bufferSize: 1, start: 1, end: 2 }); let contentRead = ''; file.on('data', function(data) { contentRead += data.toString('utf-8'); @@ -118,7 +118,7 @@ const rangeFile = path.join(common.fixturesDir, 'x.txt'); } { - const file = fs.createReadStream(rangeFile, {bufferSize: 1, start: 1}); + const file = fs.createReadStream(rangeFile, { bufferSize: 1, start: 1 }); file.data = ''; file.on('data', function(data) { file.data += data.toString('utf-8'); @@ -130,7 +130,7 @@ const rangeFile = path.join(common.fixturesDir, 'x.txt'); { // Ref: https://github.com/nodejs/node-v0.x-archive/issues/2320 - const file = fs.createReadStream(rangeFile, {bufferSize: 1.23, start: 1}); + const file = fs.createReadStream(rangeFile, { bufferSize: 1.23, start: 1 }); file.data = ''; file.on('data', function(data) { file.data += data.toString('utf-8'); @@ -141,7 +141,7 @@ const rangeFile = path.join(common.fixturesDir, 'x.txt'); } assert.throws(function() { - fs.createReadStream(rangeFile, {start: 10, end: 2}); + fs.createReadStream(rangeFile, { start: 10, end: 2 }); }, /"start" option must be <= "end" option/); { @@ -165,7 +165,7 @@ assert.throws(function() { } { - let file = fs.createReadStream(rangeFile, {autoClose: false }); + let file = fs.createReadStream(rangeFile, { autoClose: false }); let data = ''; file.on('data', function(chunk) { data += chunk; }); file.on('end', common.mustCall(function() { @@ -179,7 +179,7 @@ assert.throws(function() { function fileNext() { // This will tell us if the fd is usable again or not. - file = fs.createReadStream(null, {fd: file.fd, start: 0 }); + file = fs.createReadStream(null, { fd: file.fd, start: 0 }); file.data = ''; file.on('data', function(data) { file.data += data; @@ -196,7 +196,7 @@ assert.throws(function() { { // Just to make sure autoClose won't close the stream because of error. - const file = fs.createReadStream(null, {fd: 13337, autoClose: false }); + const file = fs.createReadStream(null, { fd: 13337, autoClose: false }); file.on('data', common.mustNotCall()); file.on('error', common.mustCall()); process.on('exit', function() { diff --git a/test/parallel/test-fs-realpath-buffer-encoding.js b/test/parallel/test-fs-realpath-buffer-encoding.js index 0ce6ec576d..67e7abd8f8 100644 --- a/test/parallel/test-fs-realpath-buffer-encoding.js +++ b/test/parallel/test-fs-realpath-buffer-encoding.js @@ -20,13 +20,13 @@ for (encoding in expected) { const expected_value = expected[encoding]; let result; - result = fs.realpathSync(string_dir, {encoding: encoding}); + result = fs.realpathSync(string_dir, { encoding: encoding }); assert.strictEqual(result, expected_value); result = fs.realpathSync(string_dir, encoding); assert.strictEqual(result, expected_value); - result = fs.realpathSync(buffer_dir, {encoding: encoding}); + result = fs.realpathSync(buffer_dir, { encoding: encoding }); assert.strictEqual(result, expected_value); result = fs.realpathSync(buffer_dir, encoding); @@ -34,13 +34,13 @@ for (encoding in expected) { } let buffer_result; -buffer_result = fs.realpathSync(string_dir, {encoding: 'buffer'}); +buffer_result = fs.realpathSync(string_dir, { encoding: 'buffer' }); assert.deepStrictEqual(buffer_result, buffer_dir); buffer_result = fs.realpathSync(string_dir, 'buffer'); assert.deepStrictEqual(buffer_result, buffer_dir); -buffer_result = fs.realpathSync(buffer_dir, {encoding: 'buffer'}); +buffer_result = fs.realpathSync(buffer_dir, { encoding: 'buffer' }); assert.deepStrictEqual(buffer_result, buffer_dir); buffer_result = fs.realpathSync(buffer_dir, 'buffer'); @@ -50,25 +50,33 @@ assert.deepStrictEqual(buffer_result, buffer_dir); for (encoding in expected) { const expected_value = expected[encoding]; - fs.realpath(string_dir, {encoding: encoding}, common.mustCall((err, res) => { - assert.ifError(err); - assert.strictEqual(res, expected_value); - })); + fs.realpath( + string_dir, + { encoding: encoding }, + common.mustCall((err, res) => { + assert.ifError(err); + assert.strictEqual(res, expected_value); + }) + ); fs.realpath(string_dir, encoding, common.mustCall((err, res) => { assert.ifError(err); assert.strictEqual(res, expected_value); })); - fs.realpath(buffer_dir, {encoding: encoding}, common.mustCall((err, res) => { - assert.ifError(err); - assert.strictEqual(res, expected_value); - })); + fs.realpath( + buffer_dir, + { encoding: encoding }, + common.mustCall((err, res) => { + assert.ifError(err); + assert.strictEqual(res, expected_value); + }) + ); fs.realpath(buffer_dir, encoding, common.mustCall((err, res) => { assert.ifError(err); assert.strictEqual(res, expected_value); })); } -fs.realpath(string_dir, {encoding: 'buffer'}, common.mustCall((err, res) => { +fs.realpath(string_dir, { encoding: 'buffer' }, common.mustCall((err, res) => { assert.ifError(err); assert.deepStrictEqual(res, buffer_dir); })); @@ -78,7 +86,7 @@ fs.realpath(string_dir, 'buffer', common.mustCall((err, res) => { assert.deepStrictEqual(res, buffer_dir); })); -fs.realpath(buffer_dir, {encoding: 'buffer'}, common.mustCall((err, res) => { +fs.realpath(buffer_dir, { encoding: 'buffer' }, common.mustCall((err, res) => { assert.ifError(err); assert.deepStrictEqual(res, buffer_dir); })); diff --git a/test/parallel/test-fs-watch-encoding.js b/test/parallel/test-fs-watch-encoding.js index 18b6f2ecf6..5226899d2f 100644 --- a/test/parallel/test-fs-watch-encoding.js +++ b/test/parallel/test-fs-watch-encoding.js @@ -43,7 +43,7 @@ function unregisterWatcher(watcher) { const watcher1 = fs.watch( common.tmpDir, - {encoding: 'hex'}, + { encoding: 'hex' }, (event, filename) => { if (['e696b0e5bbbae69687e5a4b9e4bbb62e747874', null].includes(filename)) done(watcher1); @@ -62,7 +62,7 @@ registerWatcher(watcher2); const watcher3 = fs.watch( common.tmpDir, - {encoding: 'buffer'}, + { encoding: 'buffer' }, (event, filename) => { if (filename instanceof Buffer && filename.toString('utf8') === fn) done(watcher3); diff --git a/test/parallel/test-fs-watch-recursive.js b/test/parallel/test-fs-watch-recursive.js index 8e27abb251..3e3746df1e 100644 --- a/test/parallel/test-fs-watch-recursive.js +++ b/test/parallel/test-fs-watch-recursive.js @@ -18,7 +18,7 @@ const testsubdir = fs.mkdtempSync(testDir + path.sep); const relativePathOne = path.join(path.basename(testsubdir), filenameOne); const filepathOne = path.join(testsubdir, filenameOne); -const watcher = fs.watch(testDir, {recursive: true}); +const watcher = fs.watch(testDir, { recursive: true }); let watcherClosed = false; watcher.on('change', function(event, filename) { diff --git a/test/parallel/test-fs-watchfile.js b/test/parallel/test-fs-watchfile.js index ca37073368..4d684f2f5a 100644 --- a/test/parallel/test-fs-watchfile.js +++ b/test/parallel/test-fs-watchfile.js @@ -16,7 +16,7 @@ assert.throws(function() { assert.throws(function() { fs.watchFile(new Object(), common.mustNotCall()); -}, common.expectsError({code: 'ERR_INVALID_ARG_TYPE', type: TypeError})); +}, common.expectsError({ code: 'ERR_INVALID_ARG_TYPE', type: TypeError })); const enoentFile = path.join(common.tmpDir, 'non-existent-file'); const expectedStatObject = new fs.Stats( @@ -42,7 +42,7 @@ common.refreshTmpDir(); // time, the callback should be invoked again with proper values in stat object let fileExists = false; -fs.watchFile(enoentFile, {interval: 0}, common.mustCall(function(curr, prev) { +fs.watchFile(enoentFile, { interval: 0 }, common.mustCall(function(curr, prev) { if (!fileExists) { // If the file does not exist, all the fields should be zero and the date // fields should be UNIX EPOCH time diff --git a/test/parallel/test-fs-write-file-sync.js b/test/parallel/test-fs-write-file-sync.js index d888fcd3a3..570fe743fd 100644 --- a/test/parallel/test-fs-write-file-sync.js +++ b/test/parallel/test-fs-write-file-sync.js @@ -51,9 +51,9 @@ common.refreshTmpDir(); // Test writeFileSync const file1 = path.join(common.tmpDir, 'testWriteFileSync.txt'); -fs.writeFileSync(file1, '123', {mode: mode}); +fs.writeFileSync(file1, '123', { mode: mode }); -content = fs.readFileSync(file1, {encoding: 'utf8'}); +content = fs.readFileSync(file1, { encoding: 'utf8' }); assert.strictEqual(content, '123'); assert.strictEqual(fs.statSync(file1).mode & 0o777, mode); @@ -61,9 +61,9 @@ assert.strictEqual(fs.statSync(file1).mode & 0o777, mode); // Test appendFileSync const file2 = path.join(common.tmpDir, 'testAppendFileSync.txt'); -fs.appendFileSync(file2, 'abc', {mode: mode}); +fs.appendFileSync(file2, 'abc', { mode: mode }); -content = fs.readFileSync(file2, {encoding: 'utf8'}); +content = fs.readFileSync(file2, { encoding: 'utf8' }); assert.strictEqual(content, 'abc'); assert.strictEqual(fs.statSync(file2).mode & mode, mode); @@ -75,7 +75,7 @@ const fd = fs.openSync(file3, 'w+', mode); fs.writeFileSync(fd, '123'); fs.closeSync(fd); -content = fs.readFileSync(file3, {encoding: 'utf8'}); +content = fs.readFileSync(file3, { encoding: 'utf8' }); assert.strictEqual(content, '123'); assert.strictEqual(fs.statSync(file3).mode & 0o777, mode); diff --git a/test/parallel/test-fs-write-stream-autoclose-option.js b/test/parallel/test-fs-write-stream-autoclose-option.js index 4bfa4ba534..df73d18b44 100644 --- a/test/parallel/test-fs-write-stream-autoclose-option.js +++ b/test/parallel/test-fs-write-stream-autoclose-option.js @@ -6,7 +6,7 @@ const fs = require('fs'); const file = path.join(common.tmpDir, 'write-autoclose-opt1.txt'); common.refreshTmpDir(); -let stream = fs.createWriteStream(file, {flags: 'w+', autoClose: false}); +let stream = fs.createWriteStream(file, { flags: 'w+', autoClose: false }); stream.write('Test1'); stream.end(); stream.on('finish', common.mustCall(function() { @@ -19,7 +19,7 @@ stream.on('finish', common.mustCall(function() { function next() { // This will tell us if the fd is usable again or not - stream = fs.createWriteStream(null, {fd: stream.fd, start: 0}); + stream = fs.createWriteStream(null, { fd: stream.fd, start: 0 }); stream.write('Test2'); stream.end(); stream.on('finish', common.mustCall(function() { @@ -40,7 +40,7 @@ function next2() { function next3() { // This is to test success scenario where autoClose is true - const stream = fs.createWriteStream(file, {autoClose: true}); + const stream = fs.createWriteStream(file, { autoClose: true }); stream.write('Test3'); stream.end(); stream.on('finish', common.mustCall(function() { diff --git a/test/parallel/test-fs-write-stream-throw-type-error.js b/test/parallel/test-fs-write-stream-throw-type-error.js index 62627e1e32..5652e9e5e6 100644 --- a/test/parallel/test-fs-write-stream-throw-type-error.js +++ b/test/parallel/test-fs-write-stream-throw-type-error.js @@ -27,7 +27,7 @@ assert.doesNotThrow(() => { }); assert.doesNotThrow(() => { - fs.createWriteStream(example, {encoding: 'utf8'}); + fs.createWriteStream(example, { encoding: 'utf8' }); }); assert.throws(() => { diff --git a/test/parallel/test-http-1.0-keep-alive.js b/test/parallel/test-http-1.0-keep-alive.js index f3b69a4cd0..6d117035a5 100644 --- a/test/parallel/test-http-1.0-keep-alive.js +++ b/test/parallel/test-http-1.0-keep-alive.js @@ -39,7 +39,7 @@ check([{ '\r\n' }], responses: [{ - headers: {'Connection': 'keep-alive'}, + headers: { 'Connection': 'keep-alive' }, chunks: ['OK'] }, { chunks: [] @@ -58,7 +58,7 @@ check([{ '\r\n' }], responses: [{ - headers: {'Connection': 'keep-alive'}, + headers: { 'Connection': 'keep-alive' }, chunks: ['OK'] }, { chunks: [] @@ -76,8 +76,8 @@ check([{ '\r\n' }], responses: [{ - headers: {'Connection': 'keep-alive', - 'Transfer-Encoding': 'chunked'}, + headers: { 'Connection': 'keep-alive', + 'Transfer-Encoding': 'chunked' }, chunks: ['OK'] }, { chunks: [] @@ -95,8 +95,8 @@ check([{ '\r\n' }], responses: [{ - headers: {'Connection': 'keep-alive', - 'Content-Length': '2'}, + headers: { 'Connection': 'keep-alive', + 'Content-Length': '2' }, chunks: ['OK'] }, { chunks: [] diff --git a/test/parallel/test-http-1.0.js b/test/parallel/test-http-1.0.js index f67d949bc8..47df50e289 100644 --- a/test/parallel/test-http-1.0.js +++ b/test/parallel/test-http-1.0.js @@ -61,7 +61,7 @@ function test(handler, request_generator, response_validator) { assert.strictEqual('1.0', req.httpVersion); assert.strictEqual(1, req.httpVersionMajor); assert.strictEqual(0, req.httpVersionMinor); - res.writeHead(200, {'Content-Type': 'text/plain'}); + res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end(body); } @@ -90,7 +90,7 @@ function test(handler, request_generator, response_validator) { assert.strictEqual(1, req.httpVersionMajor); assert.strictEqual(0, req.httpVersionMinor); res.sendDate = false; - res.writeHead(200, {'Content-Type': 'text/plain'}); + res.writeHead(200, { 'Content-Type': 'text/plain' }); res.write('Hello, '); res._send(''); res.write('world!'); res._send(''); res.end(); @@ -126,7 +126,7 @@ function test(handler, request_generator, response_validator) { assert.strictEqual(1, req.httpVersionMajor); assert.strictEqual(1, req.httpVersionMinor); res.sendDate = false; - res.writeHead(200, {'Content-Type': 'text/plain'}); + res.writeHead(200, { 'Content-Type': 'text/plain' }); res.write('Hello, '); res._send(''); res.write('world!'); res._send(''); res.end(); diff --git a/test/parallel/test-http-abort-queued-2.js b/test/parallel/test-http-abort-queued-2.js index ecb76c1f5e..6282aa3da7 100644 --- a/test/parallel/test-http-abort-queued-2.js +++ b/test/parallel/test-http-abort-queued-2.js @@ -22,12 +22,12 @@ server.listen(0, common.mustCall(() => { maxSockets: 1 }); - http.get({agent, port}, (res) => res.resume()); + http.get({ agent, port }, (res) => res.resume()); - const req = http.get({agent, port}, common.mustNotCall()); + const req = http.get({ agent, port }, common.mustNotCall()); req.abort(); - http.get({agent, port}, common.mustCall((res) => { + http.get({ agent, port }, common.mustCall((res) => { res.resume(); assert.strictEqual(socketsCreated, 1); agent.destroy(); diff --git a/test/parallel/test-http-abort-queued.js b/test/parallel/test-http-abort-queued.js index 788ec8c4f3..9b15fe2e74 100644 --- a/test/parallel/test-http-abort-queued.js +++ b/test/parallel/test-http-abort-queued.js @@ -43,7 +43,7 @@ const server = http.createServer(function(req, res) { server.listen(0, function() { console.log('listen', server.address().port); - const agent = new http.Agent({maxSockets: 1}); + const agent = new http.Agent({ maxSockets: 1 }); assert.strictEqual(Object.keys(agent.sockets).length, 0); const options = { diff --git a/test/parallel/test-http-abort-stream-end.js b/test/parallel/test-http-abort-stream-end.js index 8f89aeffff..ea14fe0ca9 100644 --- a/test/parallel/test-http-abort-stream-end.js +++ b/test/parallel/test-http-abort-stream-end.js @@ -31,7 +31,7 @@ let size = 0; const s = http.createServer(function(req, res) { this.close(); - res.writeHead(200, {'Content-Type': 'text/plain'}); + res.writeHead(200, { 'Content-Type': 'text/plain' }); for (let i = 0; i < maxSize; i++) { res.write('x' + i); } diff --git a/test/parallel/test-http-agent-destroyed-socket.js b/test/parallel/test-http-agent-destroyed-socket.js index 322373e69c..163664b7bd 100644 --- a/test/parallel/test-http-agent-destroyed-socket.js +++ b/test/parallel/test-http-agent-destroyed-socket.js @@ -25,10 +25,10 @@ const assert = require('assert'); const http = require('http'); const server = http.createServer(function(req, res) { - res.writeHead(200, {'Content-Type': 'text/plain'}); + res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end('Hello World\n'); }).listen(0, common.mustCall(function() { - const agent = new http.Agent({maxSockets: 1}); + const agent = new http.Agent({ maxSockets: 1 }); agent.on('free', function(socket) { console.log('freeing socket. destroyed? ', socket.destroyed); diff --git a/test/parallel/test-http-chunked.js b/test/parallel/test-http-chunked.js index 133c1d8477..d587141c6d 100644 --- a/test/parallel/test-http-chunked.js +++ b/test/parallel/test-http-chunked.js @@ -35,7 +35,7 @@ const UTF8_STRING = '南越国是前203年至前111年存在于岭南地区的 '有效的改善了岭南地区落后的政治、经济现状。'; const server = http.createServer(function(req, res) { - res.writeHead(200, {'Content-Type': 'text/plain; charset=utf8'}); + res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf8' }); res.end(UTF8_STRING, 'utf8'); }); server.listen(0, function() { diff --git a/test/parallel/test-http-client-abort2.js b/test/parallel/test-http-client-abort2.js index 7d28df2899..e6804897ea 100644 --- a/test/parallel/test-http-client-abort2.js +++ b/test/parallel/test-http-client-abort2.js @@ -28,7 +28,7 @@ const server = http.createServer(function(req, res) { }); server.listen(0, function() { - const req = http.get({port: this.address().port}, function(res) { + const req = http.get({ port: this.address().port }, function(res) { res.on('data', function(data) { req.abort(); server.close(); diff --git a/test/parallel/test-http-client-get-url.js b/test/parallel/test-http-client-get-url.js index 53ccd66182..7f6bfb8eca 100644 --- a/test/parallel/test-http-client-get-url.js +++ b/test/parallel/test-http-client-get-url.js @@ -30,7 +30,7 @@ const testPath = '/foo?bar'; const server = http.createServer(common.mustCall((req, res) => { assert.strictEqual('GET', req.method); assert.strictEqual(testPath, req.url); - res.writeHead(200, {'Content-Type': 'text/plain'}); + res.writeHead(200, { 'Content-Type': 'text/plain' }); res.write('hello\n'); res.end(); }, 3)); diff --git a/test/parallel/test-http-client-pipe-end.js b/test/parallel/test-http-client-pipe-end.js index 8195599652..4b9f168e99 100644 --- a/test/parallel/test-http-client-pipe-end.js +++ b/test/parallel/test-http-client-pipe-end.js @@ -39,7 +39,7 @@ common.refreshTmpDir(); server.listen(common.PIPE, function() { const req = http.request({ socketPath: common.PIPE, - headers: {'Content-Length': '1'}, + headers: { 'Content-Length': '1' }, method: 'POST', path: '/' }); diff --git a/test/parallel/test-http-client-race-2.js b/test/parallel/test-http-client-race-2.js index e1f8409a8c..951b8e0d74 100644 --- a/test/parallel/test-http-client-race-2.js +++ b/test/parallel/test-http-client-race-2.js @@ -44,8 +44,10 @@ const server = http.createServer(function(req, res) { default: body = body3_s; } - res.writeHead(200, - {'Content-Type': 'text/plain', 'Content-Length': body.length}); + res.writeHead(200, { + 'Content-Type': 'text/plain', + 'Content-Length': body.length + }); res.end(body); }); server.listen(0); diff --git a/test/parallel/test-http-client-race.js b/test/parallel/test-http-client-race.js index 33c74ce370..60b6b49737 100644 --- a/test/parallel/test-http-client-race.js +++ b/test/parallel/test-http-client-race.js @@ -30,8 +30,10 @@ const body2_s = '22222'; const server = http.createServer(function(req, res) { const body = url.parse(req.url).pathname === '/1' ? body1_s : body2_s; - res.writeHead(200, - {'Content-Type': 'text/plain', 'Content-Length': body.length}); + res.writeHead(200, { + 'Content-Type': 'text/plain', + 'Content-Length': body.length + }); res.end(body); }); server.listen(0); diff --git a/test/parallel/test-http-client-reject-chunked-with-content-length.js b/test/parallel/test-http-client-reject-chunked-with-content-length.js index d29e37291d..8683b5726e 100644 --- a/test/parallel/test-http-client-reject-chunked-with-content-length.js +++ b/test/parallel/test-http-client-reject-chunked-with-content-length.js @@ -17,7 +17,7 @@ server.listen(0, () => { // The callback should not be called because the server is sending // both a Content-Length header and a Transfer-Encoding: chunked // header, which is a violation of the HTTP spec. - const req = http.get({port: server.address().port}, common.mustNotCall()); + const req = http.get({ port: server.address().port }, common.mustNotCall()); req.on('error', common.mustCall((err) => { assert(/^Parse Error/.test(err.message)); assert.strictEqual(err.code, 'HPE_UNEXPECTED_CONTENT_LENGTH'); diff --git a/test/parallel/test-http-client-reject-cr-no-lf.js b/test/parallel/test-http-client-reject-cr-no-lf.js index 03dfabf0d7..bd303888bb 100644 --- a/test/parallel/test-http-client-reject-cr-no-lf.js +++ b/test/parallel/test-http-client-reject-cr-no-lf.js @@ -16,7 +16,7 @@ const server = net.createServer((socket) => { server.listen(0, () => { // The callback should not be called because the server is sending a // header field that ends only in \r with no following \n - const req = http.get({port: server.address().port}, common.mustNotCall()); + const req = http.get({ port: server.address().port }, common.mustNotCall()); req.on('error', common.mustCall((err) => { assert(/^Parse Error/.test(err.message)); assert.strictEqual(err.code, 'HPE_LF_EXPECTED'); diff --git a/test/parallel/test-http-client-reject-unexpected-agent.js b/test/parallel/test-http-client-reject-unexpected-agent.js index e89bcfad5b..f1798b483f 100644 --- a/test/parallel/test-http-client-reject-unexpected-agent.js +++ b/test/parallel/test-http-client-reject-unexpected-agent.js @@ -32,7 +32,7 @@ const server = http.createServer((req, res) => { let numberOfResponses = 0; function createRequest(agent) { - const options = Object.assign(baseOptions, {agent}); + const options = Object.assign(baseOptions, { agent }); const request = http.request(options); request.end(); request.on('response', common.mustCall(() => { diff --git a/test/parallel/test-http-client-response-domain.js b/test/parallel/test-http-client-response-domain.js index dab5711eb1..ff73fd51cc 100644 --- a/test/parallel/test-http-client-response-domain.js +++ b/test/parallel/test-http-client-response-domain.js @@ -49,7 +49,7 @@ function test() { const req = http.get({ socketPath: common.PIPE, - headers: {'Content-Length': '1'}, + headers: { 'Content-Length': '1' }, method: 'POST', path: '/' }); diff --git a/test/parallel/test-http-client-timeout-agent.js b/test/parallel/test-http-client-timeout-agent.js index b041f21ca8..641de122d5 100644 --- a/test/parallel/test-http-client-timeout-agent.js +++ b/test/parallel/test-http-client-timeout-agent.js @@ -40,7 +40,7 @@ const server = http.createServer(function(req, res) { if (reqid % 2) { // do not reply the request } else { - res.writeHead(200, {'Content-Type': 'text/plain'}); + res.writeHead(200, { 'Content-Type': 'text/plain' }); res.write(reqid.toString()); res.end(); } diff --git a/test/parallel/test-http-client-timeout-with-data.js b/test/parallel/test-http-client-timeout-with-data.js index a35611bb08..bc5670b693 100644 --- a/test/parallel/test-http-client-timeout-with-data.js +++ b/test/parallel/test-http-client-timeout-with-data.js @@ -34,7 +34,7 @@ const options = { }; const server = http.createServer(function(req, res) { - res.writeHead(200, {'Content-Length': '2'}); + res.writeHead(200, { 'Content-Length': '2' }); res.write('*'); server.once('timeout', common.mustCall(function() { res.end('*'); })); }); diff --git a/test/parallel/test-http-client-upload-buf.js b/test/parallel/test-http-client-upload-buf.js index b56c1302c2..b778d07a82 100644 --- a/test/parallel/test-http-client-upload-buf.js +++ b/test/parallel/test-http-client-upload-buf.js @@ -38,7 +38,7 @@ const server = http.createServer(common.mustCall(function(req, res) { req.on('end', common.mustCall(function() { assert.strictEqual(N, bytesReceived); console.log('request complete from server'); - res.writeHead(200, {'Content-Type': 'text/plain'}); + res.writeHead(200, { 'Content-Type': 'text/plain' }); res.write('hello\n'); res.end(); })); diff --git a/test/parallel/test-http-client-upload.js b/test/parallel/test-http-client-upload.js index 1e1f540cf0..000bf1d584 100644 --- a/test/parallel/test-http-client-upload.js +++ b/test/parallel/test-http-client-upload.js @@ -38,7 +38,7 @@ const server = http.createServer(common.mustCall(function(req, res) { req.on('end', common.mustCall(function() { assert.strictEqual('1\n2\n3\n', sent_body); console.log('request complete from server'); - res.writeHead(200, {'Content-Type': 'text/plain'}); + res.writeHead(200, { 'Content-Type': 'text/plain' }); res.write('hello\n'); res.end(); })); diff --git a/test/parallel/test-http-contentLength0.js b/test/parallel/test-http-contentLength0.js index 565de21c72..975e2abe88 100644 --- a/test/parallel/test-http-contentLength0.js +++ b/test/parallel/test-http-contentLength0.js @@ -29,7 +29,7 @@ const http = require('http'); const s = http.createServer(function(req, res) { - res.writeHead(200, {'Content-Length': '0 '}); + res.writeHead(200, { 'Content-Length': '0 ' }); res.end(); }); s.listen(0, function() { diff --git a/test/parallel/test-http-dns-error.js b/test/parallel/test-http-dns-error.js index 76634c5a83..723b710647 100644 --- a/test/parallel/test-http-dns-error.js +++ b/test/parallel/test-http-dns-error.js @@ -39,13 +39,17 @@ function test(mod) { // Bad host name should not throw an uncatchable exception. // Ensure that there is time to attach an error listener. - const req1 = mod.get({host: host, port: 42}, do_not_call); + const req1 = mod.get({ host: host, port: 42 }, do_not_call); req1.on('error', common.mustCall(function(err) { assert.strictEqual(err.code, 'ENOTFOUND'); })); // http.get() called req1.end() for us - const req2 = mod.request({method: 'GET', host: host, port: 42}, do_not_call); + const req2 = mod.request({ + method: 'GET', + host: host, + port: 42 + }, do_not_call); req2.on('error', common.mustCall(function(err) { assert.strictEqual(err.code, 'ENOTFOUND'); })); diff --git a/test/parallel/test-http-double-content-length.js b/test/parallel/test-http-double-content-length.js index 7dd9e1527c..53f924d652 100644 --- a/test/parallel/test-http-double-content-length.js +++ b/test/parallel/test-http-double-content-length.js @@ -18,7 +18,7 @@ server.listen(0, () => { const req = http.get({ port: server.address().port, // Send two content-length header values. - headers: {'Content-Length': [1, 2]} + headers: { 'Content-Length': [1, 2] } }, common.mustNotCall('an error should have occurred')); req.on('error', common.mustCall(() => { server.close(); diff --git a/test/parallel/test-http-exceptions.js b/test/parallel/test-http-exceptions.js index 6b02a98242..0b6ac5bdc1 100644 --- a/test/parallel/test-http-exceptions.js +++ b/test/parallel/test-http-exceptions.js @@ -25,7 +25,7 @@ const http = require('http'); const server = http.createServer(function(req, res) { intentionally_not_defined(); // eslint-disable-line no-undef - res.writeHead(200, {'Content-Type': 'text/plain'}); + res.writeHead(200, { 'Content-Type': 'text/plain' }); res.write('Thank you, come again.'); res.end(); }); diff --git a/test/parallel/test-http-flush-response-headers.js b/test/parallel/test-http-flush-response-headers.js index bfc43a602b..b8045568d4 100644 --- a/test/parallel/test-http-flush-response-headers.js +++ b/test/parallel/test-http-flush-response-headers.js @@ -6,7 +6,7 @@ const http = require('http'); const server = http.createServer(); server.on('request', function(req, res) { - res.writeHead(200, {'foo': 'bar'}); + res.writeHead(200, { 'foo': 'bar' }); res.flushHeaders(); res.flushHeaders(); // Should be idempotent. }); diff --git a/test/parallel/test-http-header-obstext.js b/test/parallel/test-http-header-obstext.js index 8762c75320..23aea246d7 100644 --- a/test/parallel/test-http-header-obstext.js +++ b/test/parallel/test-http-header-obstext.js @@ -13,7 +13,7 @@ const server = http.createServer(common.mustCall((req, res) => { server.listen(0, () => { http.get({ port: server.address().port, - headers: {'Test': 'Düsseldorf'} + headers: { 'Test': 'Düsseldorf' } }, common.mustCall((res) => { assert.strictEqual(res.statusCode, 200); server.close(); diff --git a/test/parallel/test-http-hostname-typechecking.js b/test/parallel/test-http-hostname-typechecking.js index e63af7d3f0..91d4d99b9a 100644 --- a/test/parallel/test-http-hostname-typechecking.js +++ b/test/parallel/test-http-hostname-typechecking.js @@ -14,8 +14,8 @@ const errHost = /^TypeError: "options\.host" must either be a string, undefined or null$/; vals.forEach((v) => { - assert.throws(() => http.request({hostname: v}), errHostname); - assert.throws(() => http.request({host: v}), errHost); + assert.throws(() => http.request({ hostname: v }), errHostname); + assert.throws(() => http.request({ host: v }), errHost); }); // These values are OK and should not throw synchronously. @@ -23,7 +23,7 @@ vals.forEach((v) => { const dontCare = () => {}; ['', undefined, null].forEach((v) => { assert.doesNotThrow(() => { - http.request({hostname: v}).on('error', dontCare).end(); - http.request({host: v}).on('error', dontCare).end(); + http.request({ hostname: v }).on('error', dontCare).end(); + http.request({ host: v }).on('error', dontCare).end(); }); }); diff --git a/test/parallel/test-http-incoming-matchKnownFields.js b/test/parallel/test-http-incoming-matchKnownFields.js index f301b9169f..14ba8acd02 100644 --- a/test/parallel/test-http-incoming-matchKnownFields.js +++ b/test/parallel/test-http-incoming-matchKnownFields.js @@ -14,80 +14,80 @@ function checkDest(field, result, value) { assert.deepStrictEqual(dest, result); } -checkDest('', {'': undefined}); -checkDest('Content-Type', {'content-type': undefined}); -checkDest('content-type', {'content-type': 'test'}, 'value'); -checkDest('User-Agent', {'user-agent': undefined}); -checkDest('user-agent', {'user-agent': 'test'}, 'value'); -checkDest('Referer', {referer: undefined}); -checkDest('referer', {referer: 'test'}, 'value'); -checkDest('Host', {host: undefined}); -checkDest('host', {host: 'test'}, 'value'); -checkDest('Authorization', {authorization: undefined}, undefined); -checkDest('authorization', {authorization: 'test'}, 'value'); -checkDest('Proxy-Authorization', {'proxy-authorization': undefined}); -checkDest('proxy-authorization', {'proxy-authorization': 'test'}, 'value'); -checkDest('If-Modified-Since', {'if-modified-since': undefined}); -checkDest('if-modified-since', {'if-modified-since': 'test'}, 'value'); -checkDest('If-Unmodified-Since', {'if-unmodified-since': undefined}); -checkDest('if-unmodified-since', {'if-unmodified-since': 'test'}, 'value'); -checkDest('Form', {form: undefined}); -checkDest('form', {form: 'test, value'}, 'value'); -checkDest('Location', {location: undefined}); -checkDest('location', {location: 'test'}, 'value'); -checkDest('Max-Forwards', {'max-forwards': undefined}); -checkDest('max-forwards', {'max-forwards': 'test'}, 'value'); -checkDest('Retry-After', {'retry-after': undefined}); -checkDest('retry-after', {'retry-after': 'test'}, 'value'); -checkDest('Etag', {etag: undefined}); -checkDest('etag', {etag: 'test'}, 'value'); -checkDest('Last-Modified', {'last-modified': undefined}); -checkDest('last-modified', {'last-modified': 'test'}, 'value'); -checkDest('Server', {server: undefined}); -checkDest('server', {server: 'test'}, 'value'); -checkDest('Age', {age: undefined}); -checkDest('age', {age: 'test'}, 'value'); -checkDest('Expires', {expires: undefined}); -checkDest('expires', {expires: 'test'}, 'value'); -checkDest('Set-Cookie', {'set-cookie': [undefined]}); -checkDest('set-cookie', {'set-cookie': ['test', 'value']}, 'value'); -checkDest('Transfer-Encoding', {'transfer-encoding': undefined}); -checkDest('transfer-encoding', {'transfer-encoding': 'test, value'}, 'value'); -checkDest('Date', {date: undefined}); -checkDest('date', {date: 'test, value'}, 'value'); -checkDest('Connection', {connection: undefined}); -checkDest('connection', {connection: 'test, value'}, 'value'); -checkDest('Cache-Control', {'cache-control': undefined}); -checkDest('cache-control', {'cache-control': 'test, value'}, 'value'); -checkDest('Transfer-Encoding', {'transfer-encoding': undefined}); -checkDest('transfer-encoding', {'transfer-encoding': 'test, value'}, 'value'); -checkDest('Vary', {vary: undefined}); -checkDest('vary', {vary: 'test, value'}, 'value'); -checkDest('Content-Encoding', {'content-encoding': undefined}, undefined); -checkDest('content-encoding', {'content-encoding': 'test, value'}, 'value'); -checkDest('Cookie', {cookie: undefined}); -checkDest('cookie', {cookie: 'test; value'}, 'value'); -checkDest('Origin', {origin: undefined}); -checkDest('origin', {origin: 'test, value'}, 'value'); -checkDest('Upgrade', {upgrade: undefined}); -checkDest('upgrade', {upgrade: 'test, value'}, 'value'); -checkDest('Expect', {expect: undefined}); -checkDest('expect', {expect: 'test, value'}, 'value'); -checkDest('If-Match', {'if-match': undefined}); -checkDest('if-match', {'if-match': 'test, value'}, 'value'); -checkDest('If-None-Match', {'if-none-match': undefined}); -checkDest('if-none-match', {'if-none-match': 'test, value'}, 'value'); -checkDest('Accept', {accept: undefined}); -checkDest('accept', {accept: 'test, value'}, 'value'); -checkDest('Accept-Encoding', {'accept-encoding': undefined}); -checkDest('accept-encoding', {'accept-encoding': 'test, value'}, 'value'); -checkDest('Accept-Language', {'accept-language': undefined}); -checkDest('accept-language', {'accept-language': 'test, value'}, 'value'); -checkDest('X-Forwarded-For', {'x-forwarded-for': undefined}); -checkDest('x-forwarded-for', {'x-forwarded-for': 'test, value'}, 'value'); -checkDest('X-Forwarded-Host', {'x-forwarded-host': undefined}); -checkDest('x-forwarded-host', {'x-forwarded-host': 'test, value'}, 'value'); -checkDest('X-Forwarded-Proto', {'x-forwarded-proto': undefined}); -checkDest('x-forwarded-proto', {'x-forwarded-proto': 'test, value'}, 'value'); -checkDest('X-Foo', {'x-foo': undefined}); -checkDest('x-foo', {'x-foo': 'test, value'}, 'value'); +checkDest('', { '': undefined }); +checkDest('Content-Type', { 'content-type': undefined }); +checkDest('content-type', { 'content-type': 'test' }, 'value'); +checkDest('User-Agent', { 'user-agent': undefined }); +checkDest('user-agent', { 'user-agent': 'test' }, 'value'); +checkDest('Referer', { referer: undefined }); +checkDest('referer', { referer: 'test' }, 'value'); +checkDest('Host', { host: undefined }); +checkDest('host', { host: 'test' }, 'value'); +checkDest('Authorization', { authorization: undefined }, undefined); +checkDest('authorization', { authorization: 'test' }, 'value'); +checkDest('Proxy-Authorization', { 'proxy-authorization': undefined }); +checkDest('proxy-authorization', { 'proxy-authorization': 'test' }, 'value'); +checkDest('If-Modified-Since', { 'if-modified-since': undefined }); +checkDest('if-modified-since', { 'if-modified-since': 'test' }, 'value'); +checkDest('If-Unmodified-Since', { 'if-unmodified-since': undefined }); +checkDest('if-unmodified-since', { 'if-unmodified-since': 'test' }, 'value'); +checkDest('Form', { form: undefined }); +checkDest('form', { form: 'test, value' }, 'value'); +checkDest('Location', { location: undefined }); +checkDest('location', { location: 'test' }, 'value'); +checkDest('Max-Forwards', { 'max-forwards': undefined }); +checkDest('max-forwards', { 'max-forwards': 'test' }, 'value'); +checkDest('Retry-After', { 'retry-after': undefined }); +checkDest('retry-after', { 'retry-after': 'test' }, 'value'); +checkDest('Etag', { etag: undefined }); +checkDest('etag', { etag: 'test' }, 'value'); +checkDest('Last-Modified', { 'last-modified': undefined }); +checkDest('last-modified', { 'last-modified': 'test' }, 'value'); +checkDest('Server', { server: undefined }); +checkDest('server', { server: 'test' }, 'value'); +checkDest('Age', { age: undefined }); +checkDest('age', { age: 'test' }, 'value'); +checkDest('Expires', { expires: undefined }); +checkDest('expires', { expires: 'test' }, 'value'); +checkDest('Set-Cookie', { 'set-cookie': [undefined] }); +checkDest('set-cookie', { 'set-cookie': ['test', 'value'] }, 'value'); +checkDest('Transfer-Encoding', { 'transfer-encoding': undefined }); +checkDest('transfer-encoding', { 'transfer-encoding': 'test, value' }, 'value'); +checkDest('Date', { date: undefined }); +checkDest('date', { date: 'test, value' }, 'value'); +checkDest('Connection', { connection: undefined }); +checkDest('connection', { connection: 'test, value' }, 'value'); +checkDest('Cache-Control', { 'cache-control': undefined }); +checkDest('cache-control', { 'cache-control': 'test, value' }, 'value'); +checkDest('Transfer-Encoding', { 'transfer-encoding': undefined }); +checkDest('transfer-encoding', { 'transfer-encoding': 'test, value' }, 'value'); +checkDest('Vary', { vary: undefined }); +checkDest('vary', { vary: 'test, value' }, 'value'); +checkDest('Content-Encoding', { 'content-encoding': undefined }, undefined); +checkDest('content-encoding', { 'content-encoding': 'test, value' }, 'value'); +checkDest('Cookie', { cookie: undefined }); +checkDest('cookie', { cookie: 'test; value' }, 'value'); +checkDest('Origin', { origin: undefined }); +checkDest('origin', { origin: 'test, value' }, 'value'); +checkDest('Upgrade', { upgrade: undefined }); +checkDest('upgrade', { upgrade: 'test, value' }, 'value'); +checkDest('Expect', { expect: undefined }); +checkDest('expect', { expect: 'test, value' }, 'value'); +checkDest('If-Match', { 'if-match': undefined }); +checkDest('if-match', { 'if-match': 'test, value' }, 'value'); +checkDest('If-None-Match', { 'if-none-match': undefined }); +checkDest('if-none-match', { 'if-none-match': 'test, value' }, 'value'); +checkDest('Accept', { accept: undefined }); +checkDest('accept', { accept: 'test, value' }, 'value'); +checkDest('Accept-Encoding', { 'accept-encoding': undefined }); +checkDest('accept-encoding', { 'accept-encoding': 'test, value' }, 'value'); +checkDest('Accept-Language', { 'accept-language': undefined }); +checkDest('accept-language', { 'accept-language': 'test, value' }, 'value'); +checkDest('X-Forwarded-For', { 'x-forwarded-for': undefined }); +checkDest('x-forwarded-for', { 'x-forwarded-for': 'test, value' }, 'value'); +checkDest('X-Forwarded-Host', { 'x-forwarded-host': undefined }); +checkDest('x-forwarded-host', { 'x-forwarded-host': 'test, value' }, 'value'); +checkDest('X-Forwarded-Proto', { 'x-forwarded-proto': undefined }); +checkDest('x-forwarded-proto', { 'x-forwarded-proto': 'test, value' }, 'value'); +checkDest('X-Foo', { 'x-foo': undefined }); +checkDest('x-foo', { 'x-foo': 'test, value' }, 'value'); diff --git a/test/parallel/test-http-invalidheaderfield.js b/test/parallel/test-http-invalidheaderfield.js index 21be4c4d6d..9e844e8a42 100644 --- a/test/parallel/test-http-invalidheaderfield.js +++ b/test/parallel/test-http-invalidheaderfield.js @@ -19,7 +19,7 @@ const server = http.createServer(function(req, res) { }); server.listen(0, function() { - http.get({port: this.address().port}, function() { + http.get({ port: this.address().port }, function() { ee.emit('done'); }); @@ -27,7 +27,7 @@ server.listen(0, function() { function() { const options = { port: server.address().port, - headers: {'testing 123': 123} + headers: { 'testing 123': 123 } }; http.get(options, common.mustNotCall()); }, @@ -41,7 +41,7 @@ server.listen(0, function() { function() { const options = { port: server.address().port, - headers: {'testing_123': 123} + headers: { 'testing_123': 123 } }; http.get(options, function() { ee.emit('done'); diff --git a/test/parallel/test-http-keep-alive-close-on-header.js b/test/parallel/test-http-keep-alive-close-on-header.js index fa459a00e6..f5fb9466db 100644 --- a/test/parallel/test-http-keep-alive-close-on-header.js +++ b/test/parallel/test-http-keep-alive-close-on-header.js @@ -25,10 +25,10 @@ const assert = require('assert'); const http = require('http'); const body = 'hello world\n'; -const headers = {'connection': 'keep-alive'}; +const headers = { 'connection': 'keep-alive' }; const server = http.createServer(function(req, res) { - res.writeHead(200, {'Content-Length': body.length, 'Connection': 'close'}); + res.writeHead(200, { 'Content-Length': body.length, 'Connection': 'close' }); res.write(body); res.end(); }); diff --git a/test/parallel/test-http-keep-alive.js b/test/parallel/test-http-keep-alive.js index 1dc65f7212..42d534e8e6 100644 --- a/test/parallel/test-http-keep-alive.js +++ b/test/parallel/test-http-keep-alive.js @@ -27,13 +27,13 @@ const http = require('http'); const server = http.createServer(common.mustCall((req, res) => { const body = 'hello world\n'; - res.writeHead(200, {'Content-Length': body.length}); + res.writeHead(200, { 'Content-Length': body.length }); res.write(body); res.end(); }, 3)); -const agent = new http.Agent({maxSockets: 1}); -const headers = {'connection': 'keep-alive'}; +const agent = new http.Agent({ maxSockets: 1 }); +const headers = { 'connection': 'keep-alive' }; let name; server.listen(0, common.mustCall(function() { diff --git a/test/parallel/test-http-malformed-request.js b/test/parallel/test-http-malformed-request.js index e0f719614e..59816b513b 100644 --- a/test/parallel/test-http-malformed-request.js +++ b/test/parallel/test-http-malformed-request.js @@ -35,7 +35,7 @@ const nrequests_expected = 1; const server = http.createServer(function(req, res) { console.log(`req: ${JSON.stringify(url.parse(req.url))}`); - res.writeHead(200, {'Content-Type': 'text/plain'}); + res.writeHead(200, { 'Content-Type': 'text/plain' }); res.write('Hello World'); res.end(); diff --git a/test/parallel/test-http-no-content-length.js b/test/parallel/test-http-no-content-length.js index f43d4da42e..a3a51c015e 100644 --- a/test/parallel/test-http-no-content-length.js +++ b/test/parallel/test-http-no-content-length.js @@ -29,7 +29,7 @@ const server = net.createServer(function(socket) { // Neither Content-Length nor Connection socket.end('HTTP/1.1 200 ok\r\n\r\nHello'); }).listen(0, common.mustCall(function() { - http.get({port: this.address().port}, common.mustCall(function(res) { + http.get({ port: this.address().port }, common.mustCall(function(res) { let body = ''; res.setEncoding('utf8'); diff --git a/test/parallel/test-http-outgoing-proto.js b/test/parallel/test-http-outgoing-proto.js index 80240c24ec..202a185c78 100644 --- a/test/parallel/test-http-outgoing-proto.js +++ b/test/parallel/test-http-outgoing-proto.js @@ -32,7 +32,7 @@ assert.throws(() => { assert.throws(() => { const outgoingMessage = new OutgoingMessage(); - outgoingMessage.setHeader.call({_header: 'test'}, 'test', 'value'); + outgoingMessage.setHeader.call({ _header: 'test' }, 'test', 'value'); }, /^Error: Can't set headers after they are sent\.$/); assert.throws(() => { @@ -46,16 +46,16 @@ assert.throws(() => { outgoingMessage.write(); }, /^Error: _implicitHeader\(\) method is not implemented$/); -assert(OutgoingMessage.prototype.write.call({_header: 'test'})); +assert(OutgoingMessage.prototype.write.call({ _header: 'test' })); assert.throws(() => { const outgoingMessage = new OutgoingMessage(); - outgoingMessage.write.call({_header: 'test', _hasBody: 'test'}); + outgoingMessage.write.call({ _header: 'test', _hasBody: 'test' }); }, /^TypeError: First argument must be a string or Buffer$/); assert.throws(() => { const outgoingMessage = new OutgoingMessage(); - outgoingMessage.write.call({_header: 'test', _hasBody: 'test'}, 1); + outgoingMessage.write.call({ _header: 'test', _hasBody: 'test' }, 1); }, /^TypeError: First argument must be a string or Buffer$/); // addTrailers @@ -66,10 +66,10 @@ assert.throws(() => { assert.throws(() => { const outgoingMessage = new OutgoingMessage(); - outgoingMessage.addTrailers({'あ': 'value'}); + outgoingMessage.addTrailers({ 'あ': 'value' }); }, /^TypeError: Trailer name must be a valid HTTP Token \["あ"\]$/); assert.throws(() => { const outgoingMessage = new OutgoingMessage(); - outgoingMessage.addTrailers({404: 'あ'}); + outgoingMessage.addTrailers({ 404: 'あ' }); }, /^TypeError: The trailer content contains invalid characters$/); diff --git a/test/parallel/test-http-parser-free.js b/test/parallel/test-http-parser-free.js index 53a9a8e5f7..1ead3c1492 100644 --- a/test/parallel/test-http-parser-free.js +++ b/test/parallel/test-http-parser-free.js @@ -35,7 +35,7 @@ server.listen(0, function() { let parser; for (let i = 0; i < N; ++i) { (function makeRequest(i) { - const req = http.get({port: server.address().port}, function(res) { + const req = http.get({ port: server.address().port }, function(res) { if (!parser) { parser = req.parser; } else { diff --git a/test/parallel/test-http-pause-resume-one-end.js b/test/parallel/test-http-pause-resume-one-end.js index c6c414cccb..4886a7d490 100644 --- a/test/parallel/test-http-pause-resume-one-end.js +++ b/test/parallel/test-http-pause-resume-one-end.js @@ -24,7 +24,7 @@ const common = require('../common'); const http = require('http'); const server = http.Server(function(req, res) { - res.writeHead(200, {'Content-Type': 'text/plain'}); + res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end('Hello World\n'); server.close(); }); diff --git a/test/parallel/test-http-proxy.js b/test/parallel/test-http-proxy.js index dfe3218a48..a6267faaa6 100644 --- a/test/parallel/test-http-proxy.js +++ b/test/parallel/test-http-proxy.js @@ -30,9 +30,9 @@ const cookies = [ 'prefers_open_id=; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT' ]; -const headers = {'content-type': 'text/plain', - 'set-cookie': cookies, - 'hello': 'world' }; +const headers = { 'content-type': 'text/plain', + 'set-cookie': cookies, + 'hello': 'world' }; const backend = http.createServer(function(req, res) { console.error('backend request'); diff --git a/test/parallel/test-http-request-end-twice.js b/test/parallel/test-http-request-end-twice.js index 27db0a6a5e..525377d2e1 100644 --- a/test/parallel/test-http-request-end-twice.js +++ b/test/parallel/test-http-request-end-twice.js @@ -25,11 +25,11 @@ const assert = require('assert'); const http = require('http'); const server = http.Server(function(req, res) { - res.writeHead(200, {'Content-Type': 'text/plain'}); + res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end('hello world\n'); }); server.listen(0, function() { - const req = http.get({port: this.address().port}, function(res) { + const req = http.get({ port: this.address().port }, function(res) { res.on('end', function() { assert.ok(!req.end()); server.close(); diff --git a/test/parallel/test-http-request-invalid-method-error.js b/test/parallel/test-http-request-invalid-method-error.js index 470f51a08f..d5dffdd221 100644 --- a/test/parallel/test-http-request-invalid-method-error.js +++ b/test/parallel/test-http-request-invalid-method-error.js @@ -4,7 +4,7 @@ const assert = require('assert'); const http = require('http'); assert.throws( - () => { http.request({method: '\0'}); }, + () => { http.request({ method: '\0' }); }, common.expectsError({ type: TypeError, message: 'Method must be a valid HTTP token' }) ); diff --git a/test/parallel/test-http-request-methods.js b/test/parallel/test-http-request-methods.js index 9be64e91a7..3532d45c63 100644 --- a/test/parallel/test-http-request-methods.js +++ b/test/parallel/test-http-request-methods.js @@ -30,7 +30,7 @@ const http = require('http'); ['DELETE', 'PATCH', 'PURGE'].forEach(function(method, index) { const server = http.createServer(common.mustCall(function(req, res) { assert.strictEqual(req.method, method); - res.writeHead(200, {'Content-Type': 'text/plain'}); + res.writeHead(200, { 'Content-Type': 'text/plain' }); res.write('hello '); res.write('world\n'); res.end(); diff --git a/test/parallel/test-http-res-write-after-end.js b/test/parallel/test-http-res-write-after-end.js index 7133e32429..32c6cf2e08 100644 --- a/test/parallel/test-http-res-write-after-end.js +++ b/test/parallel/test-http-res-write-after-end.js @@ -37,7 +37,7 @@ const server = http.Server(common.mustCall(function(req, res) { })); server.listen(0, function() { - http.get({port: this.address().port}, function(res) { + http.get({ port: this.address().port }, function(res) { server.close(); }); }); diff --git a/test/parallel/test-http-res-write-end-dont-take-array.js b/test/parallel/test-http-res-write-end-dont-take-array.js index 0d519d6059..fcf9da8c12 100644 --- a/test/parallel/test-http-res-write-end-dont-take-array.js +++ b/test/parallel/test-http-res-write-end-dont-take-array.js @@ -27,7 +27,7 @@ const http = require('http'); let test = 1; const server = http.createServer(function(req, res) { - res.writeHead(200, {'Content-Type': 'text/plain'}); + res.writeHead(200, { 'Content-Type': 'text/plain' }); if (test === 1) { // write should accept string res.write('string'); @@ -54,12 +54,12 @@ const server = http.createServer(function(req, res) { server.listen(0, function() { // just make a request, other tests handle responses - http.get({port: this.address().port}, function(res) { + http.get({ port: this.address().port }, function(res) { res.resume(); // lazy serial test, because we can only call end once per request test += 1; // do it again to test .end(Buffer); - http.get({port: server.address().port}, function(res) { + http.get({ port: server.address().port }, function(res) { res.resume(); server.close(); }); diff --git a/test/parallel/test-http-response-add-header-after-sent.js b/test/parallel/test-http-response-add-header-after-sent.js index 4261bb61ec..19b71fc31d 100644 --- a/test/parallel/test-http-response-add-header-after-sent.js +++ b/test/parallel/test-http-response-add-header-after-sent.js @@ -15,7 +15,7 @@ const server = http.createServer((req, res) => { }); server.listen(0, () => { - http.get({port: server.address().port}, () => { + http.get({ port: server.address().port }, () => { server.close(); }); }); diff --git a/test/parallel/test-http-response-multi-content-length.js b/test/parallel/test-http-response-multi-content-length.js index c915cb1d53..14015475ca 100644 --- a/test/parallel/test-http-response-multi-content-length.js +++ b/test/parallel/test-http-response-multi-content-length.js @@ -16,7 +16,7 @@ const server = http.createServer((req, res) => { res.setHeader('content-length', [2, 1]); break; case '2': - res.writeHead(200, {'content-length': [1, 2]}); + res.writeHead(200, { 'content-length': [1, 2] }); break; default: assert.fail('should never get here'); @@ -33,7 +33,7 @@ server.listen(0, common.mustCall(() => { // case, the error handler must be called because the client // is not allowed to accept multiple content-length headers. http.get( - {port: server.address().port, headers: {'x-num': n}}, + { port: server.address().port, headers: { 'x-num': n } }, (res) => { assert.fail('client allowed multiple content-length headers.'); } diff --git a/test/parallel/test-http-response-multiheaders.js b/test/parallel/test-http-response-multiheaders.js index 5739dac31d..ccfc31192d 100644 --- a/test/parallel/test-http-response-multiheaders.js +++ b/test/parallel/test-http-response-multiheaders.js @@ -56,7 +56,7 @@ server.listen(0, common.mustCall(function() { // value should be reported for the header fields listed // in the norepeat array. http.get( - {port: this.address().port, headers: {'x-num': n}}, + { port: this.address().port, headers: { 'x-num': n } }, common.mustCall(function(res) { if (++count === 2) server.close(); for (const name of norepeat) { diff --git a/test/parallel/test-http-response-remove-header-after-sent.js b/test/parallel/test-http-response-remove-header-after-sent.js index 972ccfeb8c..4e35b7e9d0 100644 --- a/test/parallel/test-http-response-remove-header-after-sent.js +++ b/test/parallel/test-http-response-remove-header-after-sent.js @@ -15,7 +15,7 @@ const server = http.createServer((req, res) => { }); server.listen(0, () => { - http.get({port: server.address().port}, () => { + http.get({ port: server.address().port }, () => { server.close(); }); }); diff --git a/test/parallel/test-http-response-splitting.js b/test/parallel/test-http-response-splitting.js index aebb6b813b..b14d59e59c 100644 --- a/test/parallel/test-http-response-splitting.js +++ b/test/parallel/test-http-response-splitting.js @@ -29,13 +29,13 @@ const server = http.createServer((req, res) => { switch (count++) { case 0: const loc = url.parse(req.url, true).query.lang; - test(res, 302, {Location: `/foo?lang=${loc}`}); + test(res, 302, { Location: `/foo?lang=${loc}` }); break; case 1: - test(res, 200, {'foo': x}); + test(res, 200, { 'foo': x }); break; case 2: - test(res, 200, {'foo': y}); + test(res, 200, { 'foo': y }); break; default: assert.fail('should not get to here.'); @@ -46,7 +46,7 @@ const server = http.createServer((req, res) => { }); server.listen(0, () => { const end = 'HTTP/1.1\r\n\r\n'; - const client = net.connect({port: server.address().port}, () => { + const client = net.connect({ port: server.address().port }, () => { client.write(`GET ${str} ${end}`); client.write(`GET / ${end}`); client.write(`GET / ${end}`); diff --git a/test/parallel/test-http-server-de-chunked-trailer.js b/test/parallel/test-http-server-de-chunked-trailer.js index d483297c5a..72c40ed559 100644 --- a/test/parallel/test-http-server-de-chunked-trailer.js +++ b/test/parallel/test-http-server-de-chunked-trailer.js @@ -14,7 +14,7 @@ const server = http.createServer(common.mustCall(function(req, res) { message: 'Trailers are invalid with this transfer encoding', type: Error }; - assert.throws(() => res.writeHead(200, {'Content-Length': '2'}), + assert.throws(() => res.writeHead(200, { 'Content-Length': '2' }), common.expectsError(trailerInvalidErr)); res.removeHeader('Trailer'); res.end('ok'); diff --git a/test/parallel/test-http-server-multiheaders.js b/test/parallel/test-http-server-multiheaders.js index 89d17d0f50..201a95c346 100644 --- a/test/parallel/test-http-server-multiheaders.js +++ b/test/parallel/test-http-server-multiheaders.js @@ -40,7 +40,7 @@ const srv = http.createServer(function(req, res) { 'foo; 1, bar; 2, baz'); assert.strictEqual(req.headers['constructor'], 'foo, bar, baz'); - res.writeHead(200, {'Content-Type': 'text/plain'}); + res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end('EOF'); srv.close(); diff --git a/test/parallel/test-http-server-multiheaders2.js b/test/parallel/test-http-server-multiheaders2.js index 265867abc6..c4a9151862 100644 --- a/test/parallel/test-http-server-multiheaders2.js +++ b/test/parallel/test-http-server-multiheaders2.js @@ -80,7 +80,7 @@ const srv = http.createServer(function(req, res) { `header parsed incorrectly: ${header}`); }); - res.writeHead(200, {'Content-Type': 'text/plain'}); + res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end('EOF'); srv.close(); diff --git a/test/parallel/test-http-server-reject-chunked-with-content-length.js b/test/parallel/test-http-server-reject-chunked-with-content-length.js index f316d86a70..b3bc4295a8 100644 --- a/test/parallel/test-http-server-reject-chunked-with-content-length.js +++ b/test/parallel/test-http-server-reject-chunked-with-content-length.js @@ -16,7 +16,7 @@ server.on('clientError', common.mustCall((err) => { server.close(); })); server.listen(0, () => { - const client = net.connect({port: server.address().port}, () => { + const client = net.connect({ port: server.address().port }, () => { client.write(reqstr); client.end(); }); diff --git a/test/parallel/test-http-server-reject-cr-no-lf.js b/test/parallel/test-http-server-reject-cr-no-lf.js index 9821715037..5dace4f7bf 100644 --- a/test/parallel/test-http-server-reject-cr-no-lf.js +++ b/test/parallel/test-http-server-reject-cr-no-lf.js @@ -18,7 +18,7 @@ server.on('clientError', common.mustCall((err) => { server.close(); })); server.listen(0, () => { - const client = net.connect({port: server.address().port}, () => { + const client = net.connect({ port: server.address().port }, () => { client.on('data', common.mustNotCall()); client.on('end', common.mustCall(() => { server.close(); diff --git a/test/parallel/test-http-server-stale-close.js b/test/parallel/test-http-server-stale-close.js index 5d903f0c42..1f3c4595d4 100644 --- a/test/parallel/test-http-server-stale-close.js +++ b/test/parallel/test-http-server-stale-close.js @@ -27,7 +27,7 @@ const fork = require('child_process').fork; if (process.env.NODE_TEST_FORK_PORT) { const req = http.request({ - headers: {'Content-Length': '42'}, + headers: { 'Content-Length': '42' }, method: 'POST', host: '127.0.0.1', port: +process.env.NODE_TEST_FORK_PORT, @@ -36,7 +36,7 @@ if (process.env.NODE_TEST_FORK_PORT) { req.end(); } else { const server = http.createServer(function(req, res) { - res.writeHead(200, {'Content-Length': '42'}); + res.writeHead(200, { 'Content-Length': '42' }); req.pipe(res); req.on('close', function() { server.close(); @@ -45,7 +45,9 @@ if (process.env.NODE_TEST_FORK_PORT) { }); server.listen(0, function() { fork(__filename, { - env: util._extend(process.env, {NODE_TEST_FORK_PORT: this.address().port}) + env: util._extend(process.env, { + NODE_TEST_FORK_PORT: this.address().port + }) }); }); } diff --git a/test/parallel/test-http-server.js b/test/parallel/test-http-server.js index 85b2be52fe..567f2b3b31 100644 --- a/test/parallel/test-http-server.js +++ b/test/parallel/test-http-server.js @@ -58,7 +58,7 @@ const server = http.createServer(function(req, res) { } setTimeout(function() { - res.writeHead(200, {'Content-Type': 'text/plain'}); + res.writeHead(200, { 'Content-Type': 'text/plain' }); res.write(url.parse(req.url).pathname); res.end(); }, 1); diff --git a/test/parallel/test-http-set-timeout.js b/test/parallel/test-http-set-timeout.js index 6253a4cc8c..5440c23c21 100644 --- a/test/parallel/test-http-set-timeout.js +++ b/test/parallel/test-http-set-timeout.js @@ -39,7 +39,7 @@ const server = http.createServer(function(req, res) { server.listen(0, function() { console.log(`Server running at http://127.0.0.1:${this.address().port}/`); - const request = http.get({port: this.address().port, path: '/'}); + const request = http.get({ port: this.address().port, path: '/' }); request.on('error', common.mustCall(function() { console.log('HTTP REQUEST COMPLETE (this is good)'); })); diff --git a/test/parallel/test-http-set-trailers.js b/test/parallel/test-http-set-trailers.js index ffd1db7238..32c322bf51 100644 --- a/test/parallel/test-http-set-trailers.js +++ b/test/parallel/test-http-set-trailers.js @@ -29,7 +29,7 @@ let outstanding_reqs = 0; const server = http.createServer(function(req, res) { res.writeHead(200, [['content-type', 'text/plain']]); - res.addTrailers({'x-foo': 'bar'}); + res.addTrailers({ 'x-foo': 'bar' }); res.end('stuff\n'); }); server.listen(0); diff --git a/test/parallel/test-http-should-keep-alive.js b/test/parallel/test-http-should-keep-alive.js index 9e3f96fd53..4c907296e7 100644 --- a/test/parallel/test-http-should-keep-alive.js +++ b/test/parallel/test-http-should-keep-alive.js @@ -50,7 +50,7 @@ const server = net.createServer(function(socket) { ++requests; }).listen(0, function() { function makeRequest() { - const req = http.get({port: server.address().port}, function(res) { + const req = http.get({ port: server.address().port }, function(res) { assert.strictEqual( req.shouldKeepAlive, SHOULD_KEEP_ALIVE[responses], `${SERVER_RESPONSES[responses]} should ${ diff --git a/test/parallel/test-http-status-code.js b/test/parallel/test-http-status-code.js index d48b71eb84..802565f26b 100644 --- a/test/parallel/test-http-status-code.js +++ b/test/parallel/test-http-status-code.js @@ -33,7 +33,7 @@ let testIdx = 0; const s = http.createServer(function(req, res) { const t = tests[testIdx]; - res.writeHead(t, {'Content-Type': 'text/plain'}); + res.writeHead(t, { 'Content-Type': 'text/plain' }); console.log(`--\nserver: statusCode after writeHead: ${res.statusCode}`); assert.strictEqual(res.statusCode, t); res.end('hello world\n'); diff --git a/test/parallel/test-http-timeout-overflow.js b/test/parallel/test-http-timeout-overflow.js index d880309a5d..dc93b3da7a 100644 --- a/test/parallel/test-http-timeout-overflow.js +++ b/test/parallel/test-http-timeout-overflow.js @@ -30,7 +30,7 @@ let clientRequests = 0; const server = http.createServer(function(req, res) { serverRequests++; - res.writeHead(200, {'Content-Type': 'text/plain'}); + res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end('OK'); }); diff --git a/test/parallel/test-http-timeout.js b/test/parallel/test-http-timeout.js index 8c24f6e16b..817bfe7a3c 100644 --- a/test/parallel/test-http-timeout.js +++ b/test/parallel/test-http-timeout.js @@ -25,11 +25,11 @@ require('../common'); const http = require('http'); const server = http.createServer(function(req, res) { - res.writeHead(200, {'Content-Type': 'text/plain'}); + res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end('OK'); }); -const agent = new http.Agent({maxSockets: 1}); +const agent = new http.Agent({ maxSockets: 1 }); server.listen(0, function() { @@ -43,7 +43,7 @@ server.listen(0, function() { function createRequest() { const req = http.request( - {port: server.address().port, path: '/', agent: agent}, + { port: server.address().port, path: '/', agent: agent }, function(res) { req.clearTimeout(callback); diff --git a/test/parallel/test-http-upgrade-server.js b/test/parallel/test-http-upgrade-server.js index 3b91afc03f..71a0758316 100644 --- a/test/parallel/test-http-upgrade-server.js +++ b/test/parallel/test-http-upgrade-server.js @@ -45,7 +45,7 @@ function testServer() { }); this.on('request', function(req, res) { - res.writeHead(200, {'Content-Type': 'text/plain'}); + res.writeHead(200, { 'Content-Type': 'text/plain' }); res.write('okay'); res.end(); }); diff --git a/test/parallel/test-http-wget.js b/test/parallel/test-http-wget.js index 5f38997872..ef06deefdf 100644 --- a/test/parallel/test-http-wget.js +++ b/test/parallel/test-http-wget.js @@ -41,7 +41,7 @@ const http = require('http'); // closed. const server = http.createServer(function(req, res) { - res.writeHead(200, {'Content-Type': 'text/plain'}); + res.writeHead(200, { 'Content-Type': 'text/plain' }); res.write('hello '); res.write('world\n'); res.end(); diff --git a/test/parallel/test-http-write-empty-string.js b/test/parallel/test-http-write-empty-string.js index a20602e39d..35a7aca61b 100644 --- a/test/parallel/test-http-write-empty-string.js +++ b/test/parallel/test-http-write-empty-string.js @@ -28,7 +28,7 @@ const http = require('http'); const server = http.createServer(function(request, response) { console.log(`responding to ${request.url}`); - response.writeHead(200, {'Content-Type': 'text/plain'}); + response.writeHead(200, { 'Content-Type': 'text/plain' }); response.write('1\n'); response.write(''); response.write('2\n'); diff --git a/test/parallel/test-http.js b/test/parallel/test-http.js index e9d4950a46..d9fa581f3b 100644 --- a/test/parallel/test-http.js +++ b/test/parallel/test-http.js @@ -53,7 +53,7 @@ const server = http.Server(common.mustCall(function(req, res) { this.close(); req.on('end', function() { - res.writeHead(200, {'Content-Type': 'text/plain'}); + res.writeHead(200, { 'Content-Type': 'text/plain' }); res.write(`The path was ${url.parse(req.url).pathname}`); res.end(); }); diff --git a/test/parallel/test-https-agent-sockets-leak.js b/test/parallel/test-https-agent-sockets-leak.js index 2fc477c0b3..3772fd3a10 100644 --- a/test/parallel/test-https-agent-sockets-leak.js +++ b/test/parallel/test-https-agent-sockets-leak.js @@ -27,7 +27,7 @@ server.listen(0, common.mustCall(() => { https.get({ host: server.address().host, port: server.address().port, - headers: {host: 'agent1'}, + headers: { host: 'agent1' }, rejectUnauthorized: true, ca: options.ca, agent: agent diff --git a/test/parallel/test-https-client-get-url.js b/test/parallel/test-https-client-get-url.js index f0e919ca64..705e779aac 100644 --- a/test/parallel/test-https-client-get-url.js +++ b/test/parallel/test-https-client-get-url.js @@ -42,7 +42,7 @@ const options = { const server = https.createServer(options, common.mustCall((req, res) => { assert.strictEqual('GET', req.method); assert.strictEqual('/foo?bar', req.url); - res.writeHead(200, {'Content-Type': 'text/plain'}); + res.writeHead(200, { 'Content-Type': 'text/plain' }); res.write('hello\n'); res.end(); }, 3)); diff --git a/test/parallel/test-https-connect-address-family.js b/test/parallel/test-https-connect-address-family.js index 76a12ef5d5..fa9baa528e 100644 --- a/test/parallel/test-https-connect-address-family.js +++ b/test/parallel/test-https-connect-address-family.js @@ -31,7 +31,7 @@ function runTest() { })); } -dns.lookup('localhost', {family: 6, all: true}, (err, addresses) => { +dns.lookup('localhost', { family: 6, all: true }, (err, addresses) => { if (err) { if (err.code === 'ENOTFOUND') common.skip('localhost does not resolve to ::1'); diff --git a/test/parallel/test-icu-stringwidth.js b/test/parallel/test-icu-stringwidth.js index 3c8021049c..da7fd79a2a 100644 --- a/test/parallel/test-icu-stringwidth.js +++ b/test/parallel/test-icu-stringwidth.js @@ -55,7 +55,7 @@ assert.strictEqual(readline.getStringWidth(0x20DD), 0); // individually. assert.strictEqual(readline.getStringWidth('👩‍👩‍👧‍👧'), 2); assert.strictEqual( - readline.getStringWidth('👩‍👩‍👧‍👧', {expandEmojiSequence: true}), 8); + readline.getStringWidth('👩‍👩‍👧‍👧', { expandEmojiSequence: true }), 8); // By default, unicode characters whose width is considered ambiguous will // be considered half-width. For these characters, getStringWidth will return @@ -65,7 +65,7 @@ assert.strictEqual( // as 2 columns. assert.strictEqual(readline.getStringWidth('\u01d4'), 1); assert.strictEqual( - readline.getStringWidth('\u01d4', {ambiguousAsFullWidth: true}), 2); + readline.getStringWidth('\u01d4', { ambiguousAsFullWidth: true }), 2); // Control chars and combining chars are zero assert.strictEqual(readline.getStringWidth('\u200E\n\u220A\u20D2'), 1); diff --git a/test/parallel/test-inspector-open.js b/test/parallel/test-inspector-open.js index 346393d6fa..1e2485a1df 100644 --- a/test/parallel/test-inspector-open.js +++ b/test/parallel/test-inspector-open.js @@ -13,12 +13,12 @@ const url = require('url'); if (process.env.BE_CHILD) return beChild(); -const child = fork(__filename, {env: {BE_CHILD: 1}}); +const child = fork(__filename, { env: { BE_CHILD: 1 } }); child.once('message', common.mustCall((msg) => { assert.strictEqual(msg.cmd, 'started'); - child.send({cmd: 'open', args: [0]}); + child.send({ cmd: 'open', args: [0] }); child.once('message', common.mustCall(firstOpen)); })); @@ -30,7 +30,7 @@ function firstOpen(msg) { ping(port, (err) => { assert.ifError(err); // Inspector is already open, and won't be reopened, so args don't matter. - child.send({cmd: 'open', args: []}); + child.send({ cmd: 'open', args: [] }); child.once('message', common.mustCall(tryToOpenWhenOpen)); firstPort = port; }); @@ -43,7 +43,7 @@ function tryToOpenWhenOpen(msg) { assert.strictEqual(port, firstPort); ping(port, (err) => { assert.ifError(err); - child.send({cmd: 'close'}); + child.send({ cmd: 'close' }); child.once('message', common.mustCall(closeWhenOpen)); }); } @@ -53,7 +53,7 @@ function closeWhenOpen(msg) { assert.strictEqual(msg.url, undefined); ping(firstPort, (err) => { assert(err); - child.send({cmd: 'close'}); + child.send({ cmd: 'close' }); child.once('message', common.mustCall(tryToCloseWhenClosed)); }); } @@ -61,7 +61,7 @@ function closeWhenOpen(msg) { function tryToCloseWhenClosed(msg) { assert.strictEqual(msg.cmd, 'url'); assert.strictEqual(msg.url, undefined); - child.send({cmd: 'open', args: []}); + child.send({ cmd: 'open', args: [] }); child.once('message', common.mustCall(reopenAfterClose)); } @@ -89,7 +89,7 @@ function ping(port, callback) { function beChild() { const inspector = require('inspector'); - process.send({cmd: 'started'}); + process.send({ cmd: 'started' }); process.on('message', (msg) => { if (msg.cmd === 'open') { @@ -98,6 +98,6 @@ function beChild() { if (msg.cmd === 'close') { inspector.close(); } - process.send({cmd: 'url', url: inspector.url()}); + process.send({ cmd: 'url', url: inspector.url() }); }); } diff --git a/test/parallel/test-internal-fs.js b/test/parallel/test-internal-fs.js index 6e312ff6fc..fe6c50194d 100644 --- a/test/parallel/test-internal-fs.js +++ b/test/parallel/test-internal-fs.js @@ -9,5 +9,5 @@ assert.doesNotThrow(() => fs.assertEncoding()); assert.doesNotThrow(() => fs.assertEncoding('utf8')); common.expectsError( () => fs.assertEncoding('foo'), - {code: 'ERR_INVALID_OPT_VALUE_ENCODING', type: TypeError} + { code: 'ERR_INVALID_OPT_VALUE_ENCODING', type: TypeError } ); diff --git a/test/parallel/test-intl.js b/test/parallel/test-intl.js index ff9569774d..1999914c88 100644 --- a/test/parallel/test-intl.js +++ b/test/parallel/test-intl.js @@ -65,9 +65,11 @@ if (!common.hasIntl) { const GMT = 'Etc/GMT'; // Construct an English formatter. Should format to "Jan 70" - const dtf = - new Intl.DateTimeFormat(['en'], - {timeZone: GMT, month: 'short', year: '2-digit'}); + const dtf = new Intl.DateTimeFormat(['en'], { + timeZone: GMT, + month: 'short', + year: '2-digit' + }); // If list is specified and doesn't contain 'en' then return. if (process.config.variables.icu_locales && !haveLocale('en')) { @@ -89,7 +91,7 @@ if (!common.hasIntl) { assert.strictEqual(localeString, 'Jan 70'); } // Options to request GMT - const optsGMT = {timeZone: GMT}; + const optsGMT = { timeZone: GMT }; // Test format { diff --git a/test/parallel/test-listen-fd-ebadf.js b/test/parallel/test-listen-fd-ebadf.js index 82340c8bea..0f09d386d5 100644 --- a/test/parallel/test-listen-fd-ebadf.js +++ b/test/parallel/test-listen-fd-ebadf.js @@ -24,9 +24,9 @@ const common = require('../common'); const assert = require('assert'); const net = require('net'); -net.createServer(common.mustNotCall()).listen({fd: 2}) +net.createServer(common.mustNotCall()).listen({ fd: 2 }) .on('error', common.mustCall(onError)); -net.createServer(common.mustNotCall()).listen({fd: 42}) +net.createServer(common.mustNotCall()).listen({ fd: 42 }) .on('error', common.mustCall(onError)); function onError(ex) { diff --git a/test/parallel/test-module-symlinked-peer-modules.js b/test/parallel/test-module-symlinked-peer-modules.js index 5fe3169ee8..e3d538c42b 100644 --- a/test/parallel/test-module-symlinked-peer-modules.js +++ b/test/parallel/test-module-symlinked-peer-modules.js @@ -49,13 +49,13 @@ try { } fs.writeFileSync(path.join(moduleA, 'package.json'), - JSON.stringify({name: 'moduleA', main: 'index.js'}), 'utf8'); + JSON.stringify({ name: 'moduleA', main: 'index.js' }), 'utf8'); fs.writeFileSync(path.join(moduleA, 'index.js'), 'module.exports = require(\'moduleB\');', 'utf8'); fs.writeFileSync(path.join(app, 'index.js'), '\'use strict\'; require(\'moduleA\');', 'utf8'); fs.writeFileSync(path.join(moduleB, 'package.json'), - JSON.stringify({name: 'moduleB', main: 'index.js'}), 'utf8'); + JSON.stringify({ name: 'moduleB', main: 'index.js' }), 'utf8'); fs.writeFileSync(path.join(moduleB, 'index.js'), 'module.exports = 1;', 'utf8'); diff --git a/test/parallel/test-net-connect-call-socket-connect.js b/test/parallel/test-net-connect-call-socket-connect.js index 8d3413d9aa..88551889fe 100644 --- a/test/parallel/test-net-connect-call-socket-connect.js +++ b/test/parallel/test-net-connect-call-socket-connect.js @@ -30,7 +30,7 @@ const server = net.createServer(); server.listen(common.mustCall(function() { const port = server.address().port; - const client = net.connect({port}, common.mustCall(function() { + const client = net.connect({ port }, common.mustCall(function() { client.end(); })); client.on('end', common.mustCall(function() { diff --git a/test/parallel/test-net-connect-immediate-finish.js b/test/parallel/test-net-connect-immediate-finish.js index 209b90d71d..1006a62d33 100644 --- a/test/parallel/test-net-connect-immediate-finish.js +++ b/test/parallel/test-net-connect-immediate-finish.js @@ -24,7 +24,7 @@ const common = require('../common'); const assert = require('assert'); const net = require('net'); -const client = net.connect({host: '***', port: common.PORT}); +const client = net.connect({ host: '***', port: common.PORT }); client.once('error', common.mustCall((err) => { assert(err); diff --git a/test/parallel/test-net-connect-options-fd.js b/test/parallel/test-net-connect-options-fd.js index 68e63f0ba4..e0872cf7c5 100644 --- a/test/parallel/test-net-connect-options-fd.js +++ b/test/parallel/test-net-connect-options-fd.js @@ -69,7 +69,7 @@ const forAllClients = (cb) => common.mustCall(cb, CLIENT_VARIANTS); console.error(err); assert.fail(null, null, `[Pipe server]${err}`); }) - .listen({path: serverPath}, common.mustCall(function serverOnListen() { + .listen({ path: serverPath }, common.mustCall(function serverOnListen() { const getSocketOpt = (index) => { const handle = new Pipe(); const err = handle.bind(`${prefix}-client-${socketCounter++}`); diff --git a/test/parallel/test-net-connect-options-ipv6.js b/test/parallel/test-net-connect-options-ipv6.js index 29b07645c4..aba07d9fcc 100644 --- a/test/parallel/test-net-connect-options-ipv6.js +++ b/test/parallel/test-net-connect-options-ipv6.js @@ -32,7 +32,7 @@ let hostIdx = 0; let host = hosts[hostIdx]; let localhostTries = 10; -const server = net.createServer({allowHalfOpen: true}, function(socket) { +const server = net.createServer({ allowHalfOpen: true }, function(socket) { socket.resume(); socket.on('end', common.mustCall()); socket.end(); diff --git a/test/parallel/test-net-connect-options-path.js b/test/parallel/test-net-connect-options-path.js index 927bd95207..07c5446fc6 100644 --- a/test/parallel/test-net-connect-options-path.js +++ b/test/parallel/test-net-connect-options-path.js @@ -40,14 +40,14 @@ const CLIENT_VARIANTS = 12; new net.Socket().connect(serverPath, getConnectCb()); new net.Socket().connect(serverPath) .on('connect', getConnectCb()); - net.connect({path: serverPath}, getConnectCb()); - net.connect({path: serverPath}) + net.connect({ path: serverPath }, getConnectCb()); + net.connect({ path: serverPath }) .on('connect', getConnectCb()); - net.createConnection({path: serverPath}, getConnectCb()); - net.createConnection({path: serverPath}) + net.createConnection({ path: serverPath }, getConnectCb()); + net.createConnection({ path: serverPath }) .on('connect', getConnectCb()); - new net.Socket().connect({path: serverPath}, getConnectCb()); - new net.Socket().connect({path: serverPath}) + new net.Socket().connect({ path: serverPath }, getConnectCb()); + new net.Socket().connect({ path: serverPath }) .on('connect', getConnectCb()); })); } diff --git a/test/parallel/test-net-connect-options-port.js b/test/parallel/test-net-connect-options-port.js index 1a2bd850f3..bc9e76df65 100644 --- a/test/parallel/test-net-connect-options-port.js +++ b/test/parallel/test-net-connect-options-port.js @@ -63,7 +63,7 @@ const net = require('net'); const regexp = /^TypeError: Invalid argument: hints must use valid flags$/; // connect({hint}, cb) and connect({hint}) const hints = (dns.ADDRCONFIG | dns.V4MAPPED) + 42; - const hintOptBlocks = doConnect([{hints: hints}], + const hintOptBlocks = doConnect([{ hints: hints }], () => common.mustNotCall()); for (const block of hintOptBlocks) { assert.throws(block, regexp, @@ -143,14 +143,14 @@ function syncFailToConnect(port, regexp, optOnly) { } } // connect({port}, cb) and connect({port}) - const portOptBlocks = doConnect([{port}], + const portOptBlocks = doConnect([{ port }], () => common.mustNotCall()); for (const block of portOptBlocks) { assert.throws(block, regexp, `${block.name}({port: ${port}})`); } // connect({port, host}, cb) and connect({port, host}) - const portHostOptBlocks = doConnect([{port: port, host: 'localhost'}], + const portHostOptBlocks = doConnect([{ port: port, host: 'localhost' }], () => common.mustNotCall()); for (const block of portHostOptBlocks) { assert.throws(block, regexp, @@ -174,13 +174,13 @@ function canConnect(port) { } // connect({port}, cb) and connect({port}) - const portOptBlocks = doConnect([{port}], noop); + const portOptBlocks = doConnect([{ port }], noop); for (const block of portOptBlocks) { assert.doesNotThrow(block, `${block.name}({port: ${port}})`); } // connect({port, host}, cb) and connect({port, host}) - const portHostOptBlocks = doConnect([{port: port, host: 'localhost'}], + const portHostOptBlocks = doConnect([{ port: port, host: 'localhost' }], noop); for (const block of portHostOptBlocks) { assert.doesNotThrow(block, @@ -204,7 +204,7 @@ function asyncFailToConnect(port) { } // connect({port}, cb) and connect({port}) - const portOptBlocks = doConnect([{port}], dont); + const portOptBlocks = doConnect([{ port }], dont); for (const block of portOptBlocks) { assert.doesNotThrow(function() { block().on('error', onError()); @@ -212,7 +212,7 @@ function asyncFailToConnect(port) { } // connect({port, host}, cb) and connect({port, host}) - const portHostOptBlocks = doConnect([{port: port, host: 'localhost'}], + const portHostOptBlocks = doConnect([{ port: port, host: 'localhost' }], dont); for (const block of portHostOptBlocks) { assert.doesNotThrow(function() { diff --git a/test/parallel/test-net-listen-fd0.js b/test/parallel/test-net-listen-fd0.js index 58b184ff10..c9ba56b5ae 100644 --- a/test/parallel/test-net-listen-fd0.js +++ b/test/parallel/test-net-listen-fd0.js @@ -26,7 +26,7 @@ const net = require('net'); // This should fail with an async EINVAL error, not throw an exception net.createServer(common.mustNotCall()) - .listen({fd: 0}) + .listen({ fd: 0 }) .on('error', common.mustCall(function(e) { assert(e instanceof Error); assert(['EINVAL', 'ENOTSOCK'].includes(e.code)); diff --git a/test/parallel/test-net-server-connections-child-null.js b/test/parallel/test-net-server-connections-child-null.js index a8a1346fec..cbe2d22052 100644 --- a/test/parallel/test-net-server-connections-child-null.js +++ b/test/parallel/test-net-server-connections-child-null.js @@ -23,7 +23,7 @@ if (process.argv[2] === 'child') { // server.connections should start as 0 assert.strictEqual(server.connections, 0); server.on('connection', (socket) => { - child.send({what: 'socket'}, socket); + child.send({ what: 'socket' }, socket); }); server.on('close', () => { child.kill(); diff --git a/test/parallel/test-net-server-listen-handle.js b/test/parallel/test-net-server-listen-handle.js index 09398bd0e3..db8e639f94 100644 --- a/test/parallel/test-net-server-listen-handle.js +++ b/test/parallel/test-net-server-listen-handle.js @@ -91,27 +91,27 @@ if (!common.isWindows) { // Windows doesn't support {fd: } { // Test listen({handle: tcp}, cb) net.createServer() - .listen({handle: randomHandle('tcp')}, closeServer()); + .listen({ handle: randomHandle('tcp') }, closeServer()); // Test listen({handle: tcp}) net.createServer() - .listen({handle: randomHandle('tcp')}) + .listen({ handle: randomHandle('tcp') }) .on('listening', closeServer()); // Test listen({_handle: tcp}, cb) net.createServer() - .listen({_handle: randomHandle('tcp')}, closeServer()); + .listen({ _handle: randomHandle('tcp') }, closeServer()); // Test listen({_handle: tcp}) net.createServer() - .listen({_handle: randomHandle('tcp')}) + .listen({ _handle: randomHandle('tcp') }) .on('listening', closeServer()); } if (!common.isWindows) { // Windows doesn't support {fd: } // Test listen({fd: tcp.fd}, cb) net.createServer() - .listen({fd: randomHandle('tcp').fd}, closeServer()); + .listen({ fd: randomHandle('tcp').fd }, closeServer()); // Test listen({fd: tcp.fd}) net.createServer() - .listen({fd: randomHandle('tcp').fd}) + .listen({ fd: randomHandle('tcp').fd }) .on('listening', closeServer()); } @@ -119,24 +119,24 @@ if (!common.isWindows) { // Windows doesn't support {fd: } const handles = randomPipes(6); // generate pipes in advance // Test listen({handle: pipe}, cb) net.createServer() - .listen({handle: handles[0]}, closePipeServer(handles[0])); + .listen({ handle: handles[0] }, closePipeServer(handles[0])); // Test listen({handle: pipe}) net.createServer() - .listen({handle: handles[1]}) + .listen({ handle: handles[1] }) .on('listening', closePipeServer(handles[1])); // Test listen({_handle: pipe}, cb) net.createServer() - .listen({_handle: handles[2]}, closePipeServer(handles[2])); + .listen({ _handle: handles[2] }, closePipeServer(handles[2])); // Test listen({_handle: pipe}) net.createServer() - .listen({_handle: handles[3]}) + .listen({ _handle: handles[3] }) .on('listening', closePipeServer(handles[3])); // Test listen({fd: pipe.fd}, cb) net.createServer() - .listen({fd: handles[4].fd}, closePipeServer(handles[4])); + .listen({ fd: handles[4].fd }, closePipeServer(handles[4])); // Test listen({fd: pipe.fd}) net.createServer() - .listen({fd: handles[5].fd}) + .listen({ fd: handles[5].fd }) .on('listening', closePipeServer(handles[5])); } @@ -144,7 +144,7 @@ if (!common.isWindows) { // Windows doesn't support {fd: } // Test invalid fd const fd = fs.openSync(__filename, 'r'); net.createServer() - .listen({fd: fd}, common.mustNotCall()) + .listen({ fd: fd }, common.mustNotCall()) .on('error', common.mustCall(function(err) { assert.strictEqual(String(err), 'Error: listen EINVAL'); this.close(); diff --git a/test/parallel/test-net-server-listen-options.js b/test/parallel/test-net-server-listen-options.js index 494a331223..d2e70215dc 100644 --- a/test/parallel/test-net-server-listen-options.js +++ b/test/parallel/test-net-server-listen-options.js @@ -25,13 +25,13 @@ function listenError(literals, ...values) { // Test listen(port) net.createServer().listen(0).on('listening', common.mustCall(close)); // Test listen({port}) - net.createServer().listen({port: 0}) + net.createServer().listen({ port: 0 }) .on('listening', common.mustCall(close)); } // Test listen(port, cb) and listen({port: port}, cb) combinations const listenOnPort = [ - (port, cb) => net.createServer().listen({port}, cb), + (port, cb) => net.createServer().listen({ port }, cb), (port, cb) => net.createServer().listen(port, cb) ]; diff --git a/test/parallel/test-net-server-listen-path.js b/test/parallel/test-net-server-listen-path.js index 2dbd588baf..53173fa66d 100644 --- a/test/parallel/test-net-server-listen-path.js +++ b/test/parallel/test-net-server-listen-path.js @@ -30,7 +30,7 @@ function randomPipePath() { { const handlePath = randomPipePath(); net.createServer() - .listen({path: handlePath}) + .listen({ path: handlePath }) .on('listening', closeServer()); } @@ -45,5 +45,5 @@ function randomPipePath() { { const handlePath = randomPipePath(); net.createServer() - .listen({path: handlePath}, closeServer()); + .listen({ path: handlePath }, closeServer()); } diff --git a/test/parallel/test-net-server-pause-on-connect.js b/test/parallel/test-net-server-pause-on-connect.js index e015c24323..84cc91d56c 100644 --- a/test/parallel/test-net-server-pause-on-connect.js +++ b/test/parallel/test-net-server-pause-on-connect.js @@ -42,7 +42,7 @@ const server1ConnHandler = (socket) => { server1Sock = socket; }; -const server1 = net.createServer({pauseOnConnect: true}, server1ConnHandler); +const server1 = net.createServer({ pauseOnConnect: true }, server1ConnHandler); const server2ConnHandler = (socket) => { socket.on('data', function(data) { @@ -57,15 +57,15 @@ const server2ConnHandler = (socket) => { }); }; -const server2 = net.createServer({pauseOnConnect: false}, server2ConnHandler); +const server2 = net.createServer({ pauseOnConnect: false }, server2ConnHandler); server1.listen(0, function() { const clientHandler = common.mustCall(function() { server2.listen(0, function() { - net.createConnection({port: this.address().port}).write(msg); + net.createConnection({ port: this.address().port }).write(msg); }); }); - net.createConnection({port: this.address().port}).write(msg, clientHandler); + net.createConnection({ port: this.address().port }).write(msg, clientHandler); }); process.on('exit', function() { diff --git a/test/parallel/test-net-socket-timeout-unref.js b/test/parallel/test-net-socket-timeout-unref.js index 1e95fe6b0f..ae6bde49ab 100644 --- a/test/parallel/test-net-socket-timeout-unref.js +++ b/test/parallel/test-net-socket-timeout-unref.js @@ -52,5 +52,5 @@ delays.forEach(function(T) { } })); - sockets.push({socket: socket, timeout: T * 1000}); + sockets.push({ socket: socket, timeout: T * 1000 }); }); diff --git a/test/parallel/test-net-socket-write-after-close.js b/test/parallel/test-net-socket-write-after-close.js index 6d2d2fdd02..d3a3d937d3 100644 --- a/test/parallel/test-net-socket-write-after-close.js +++ b/test/parallel/test-net-socket-write-after-close.js @@ -8,7 +8,7 @@ const net = require('net'); server.listen(common.mustCall(() => { const port = server.address().port; - const client = net.connect({port}, common.mustCall(() => { + const client = net.connect({ port }, common.mustCall(() => { client.on('error', common.mustCall((err) => { server.close(); assert.strictEqual(err.constructor, Error); @@ -25,7 +25,7 @@ const net = require('net'); server.listen(common.mustCall(() => { const port = server.address().port; - const client = net.connect({port}, common.mustCall(() => { + const client = net.connect({ port }, common.mustCall(() => { client.on('error', common.mustCall((err) => { server.close(); assert.strictEqual(err.constructor, Error); diff --git a/test/parallel/test-openssl-ca-options.js b/test/parallel/test-openssl-ca-options.js index f8f777e268..21f77b90d1 100644 --- a/test/parallel/test-openssl-ca-options.js +++ b/test/parallel/test-openssl-ca-options.js @@ -12,7 +12,7 @@ const result = childProcess.spawnSync(process.execPath, [ '--use-bundled-ca', '--use-openssl-ca', '-p', 'process.version'], - {encoding: 'utf8'}); + { encoding: 'utf8' }); assert.strictEqual(result.stderr, `${process.execPath }: either --use-openssl-ca or --use-bundled-ca can be used, not both${os.EOL}` diff --git a/test/parallel/test-path-parse-format.js b/test/parallel/test-path-parse-format.js index b253249472..5d78a6f526 100644 --- a/test/parallel/test-path-parse-format.js +++ b/test/parallel/test-path-parse-format.js @@ -42,16 +42,16 @@ const winPaths = [ ]; const winSpecialCaseParseTests = [ - ['/foo/bar', {root: '/'}] + ['/foo/bar', { root: '/' }] ]; const winSpecialCaseFormatTests = [ - [{dir: 'some\\dir'}, 'some\\dir\\'], - [{base: 'index.html'}, 'index.html'], - [{root: 'C:\\'}, 'C:\\'], - [{name: 'index', ext: '.html'}, 'index.html'], - [{dir: 'some\\dir', name: 'index', ext: '.html'}, 'some\\dir\\index.html'], - [{root: 'C:\\', name: 'index', ext: '.html'}, 'C:\\index.html'], + [{ dir: 'some\\dir' }, 'some\\dir\\'], + [{ base: 'index.html' }, 'index.html'], + [{ root: 'C:\\' }, 'C:\\'], + [{ name: 'index', ext: '.html' }, 'index.html'], + [{ dir: 'some\\dir', name: 'index', ext: '.html' }, 'some\\dir\\index.html'], + [{ root: 'C:\\', name: 'index', ext: '.html' }, 'C:\\index.html'], [{}, ''] ]; @@ -79,12 +79,12 @@ const unixPaths = [ ]; const unixSpecialCaseFormatTests = [ - [{dir: 'some/dir'}, 'some/dir/'], - [{base: 'index.html'}, 'index.html'], - [{root: '/'}, '/'], - [{name: 'index', ext: '.html'}, 'index.html'], - [{dir: 'some/dir', name: 'index', ext: '.html'}, 'some/dir/index.html'], - [{root: '/', name: 'index', ext: '.html'}, '/index.html'], + [{ dir: 'some/dir' }, 'some/dir/'], + [{ base: 'index.html' }, 'index.html'], + [{ root: '/' }, '/'], + [{ name: 'index', ext: '.html' }, 'index.html'], + [{ dir: 'some/dir', name: 'index', ext: '.html' }, 'some/dir/index.html'], + [{ root: '/', name: 'index', ext: '.html' }, '/index.html'], [{}, ''] ]; @@ -94,15 +94,15 @@ const expectedMessage = common.expectsError({ }, 18); const errors = [ - {method: 'parse', input: [null], message: expectedMessage}, - {method: 'parse', input: [{}], message: expectedMessage}, - {method: 'parse', input: [true], message: expectedMessage}, - {method: 'parse', input: [1], message: expectedMessage}, - {method: 'parse', input: [], message: expectedMessage}, - {method: 'format', input: [null], message: expectedMessage}, - {method: 'format', input: [''], message: expectedMessage}, - {method: 'format', input: [true], message: expectedMessage}, - {method: 'format', input: [1], message: expectedMessage}, + { method: 'parse', input: [null], message: expectedMessage }, + { method: 'parse', input: [{}], message: expectedMessage }, + { method: 'parse', input: [true], message: expectedMessage }, + { method: 'parse', input: [1], message: expectedMessage }, + { method: 'parse', input: [], message: expectedMessage }, + { method: 'format', input: [null], message: expectedMessage }, + { method: 'format', input: [''], message: expectedMessage }, + { method: 'format', input: [true], message: expectedMessage }, + { method: 'format', input: [1], message: expectedMessage }, ]; checkParseFormat(path.win32, winPaths); diff --git a/test/parallel/test-path.js b/test/parallel/test-path.js index 4ee3740038..600c463370 100644 --- a/test/parallel/test-path.js +++ b/test/parallel/test-path.js @@ -372,7 +372,7 @@ function fail(fn) { assert.throws(() => { fn.apply(null, args); - }, common.expectsError({code: 'ERR_INVALID_ARG_TYPE', type: TypeError})); + }, common.expectsError({ code: 'ERR_INVALID_ARG_TYPE', type: TypeError })); } typeErrorTests.forEach((test) => { diff --git a/test/parallel/test-pending-deprecation.js b/test/parallel/test-pending-deprecation.js index 402ec79b1b..fedc7c96b8 100644 --- a/test/parallel/test-pending-deprecation.js +++ b/test/parallel/test-pending-deprecation.js @@ -37,7 +37,7 @@ switch (process.argv[2]) { // Test the NODE_PENDING_DEPRECATION environment var. fork(__filename, ['env'], { - env: {NODE_PENDING_DEPRECATION: 1}, + env: { NODE_PENDING_DEPRECATION: 1 }, silent: true }).on('exit', common.mustCall((code) => { assert.strictEqual(code, 0, message('NODE_PENDING_DEPRECATION')); diff --git a/test/parallel/test-pipe-file-to-http.js b/test/parallel/test-pipe-file-to-http.js index ccb1c1c612..244dcd1a99 100644 --- a/test/parallel/test-pipe-file-to-http.js +++ b/test/parallel/test-pipe-file-to-http.js @@ -49,7 +49,7 @@ const server = http.createServer(function(req, res) { if (timeoutId) { clearTimeout(timeoutId); } - res.writeHead(200, {'Content-Type': 'text/plain'}); + res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end(); }); }); diff --git a/test/parallel/test-preload.js b/test/parallel/test-preload.js index a5f8a0c276..cfba522844 100644 --- a/test/parallel/test-preload.js +++ b/test/parallel/test-preload.js @@ -68,7 +68,7 @@ childProcess.exec( const stdinProc = childProcess.spawn( nodeBinary, ['--require', fixtureA], - {stdio: 'pipe'} + { stdio: 'pipe' } ); stdinProc.stdin.end("console.log('hello');"); let stdinStdout = ''; @@ -84,7 +84,7 @@ stdinProc.on('close', function(code) { const replProc = childProcess.spawn( nodeBinary, ['-i', '--require', fixtureA], - {stdio: 'pipe'} + { stdio: 'pipe' } ); replProc.stdin.end('.exit\n'); let replStdout = ''; diff --git a/test/parallel/test-process-emitwarning.js b/test/parallel/test-process-emitwarning.js index 0349f30cd9..06772c7be6 100644 --- a/test/parallel/test-process-emitwarning.js +++ b/test/parallel/test-process-emitwarning.js @@ -58,7 +58,7 @@ warningThrowToString.toString = function() { process.emitWarning(warningThrowToString); const expectedError = - common.expectsError({code: 'ERR_INVALID_ARG_TYPE', type: TypeError}, 11); + common.expectsError({ code: 'ERR_INVALID_ARG_TYPE', type: TypeError }, 11); // TypeError is thrown on invalid input assert.throws(() => process.emitWarning(1), expectedError); diff --git a/test/parallel/test-process-external-stdio-close.js b/test/parallel/test-process-external-stdio-close.js index 798ee00d05..067a75ec93 100644 --- a/test/parallel/test-process-external-stdio-close.js +++ b/test/parallel/test-process-external-stdio-close.js @@ -14,7 +14,7 @@ if (process.argv[2] === 'child') { process.disconnect(); })); } else { - const child = cp.fork(__filename, ['child'], {silent: true}); + const child = cp.fork(__filename, ['child'], { silent: true }); child.on('close', common.mustCall((exitCode, signal) => { assert.strictEqual(exitCode, 0); diff --git a/test/parallel/test-process-redirect-warnings-env.js b/test/parallel/test-process-redirect-warnings-env.js index ae21cff378..6878024e79 100644 --- a/test/parallel/test-process-redirect-warnings-env.js +++ b/test/parallel/test-process-redirect-warnings-env.js @@ -16,7 +16,7 @@ common.refreshTmpDir(); const warnmod = require.resolve(`${common.fixturesDir}/warnings.js`); const warnpath = path.join(common.tmpDir, 'warnings.txt'); -fork(warnmod, {env: {NODE_REDIRECT_WARNINGS: warnpath}}) +fork(warnmod, { env: { NODE_REDIRECT_WARNINGS: warnpath } }) .on('exit', common.mustCall(() => { fs.readFile(warnpath, 'utf8', common.mustCall((err, data) => { assert.ifError(err); diff --git a/test/parallel/test-process-redirect-warnings.js b/test/parallel/test-process-redirect-warnings.js index b1097469b2..d38a2e97e2 100644 --- a/test/parallel/test-process-redirect-warnings.js +++ b/test/parallel/test-process-redirect-warnings.js @@ -16,7 +16,7 @@ common.refreshTmpDir(); const warnmod = require.resolve(`${common.fixturesDir}/warnings.js`); const warnpath = path.join(common.tmpDir, 'warnings.txt'); -fork(warnmod, {execArgv: [`--redirect-warnings=${warnpath}`]}) +fork(warnmod, { execArgv: [`--redirect-warnings=${warnpath}`] }) .on('exit', common.mustCall(() => { fs.readFile(warnpath, 'utf8', common.mustCall((err, data) => { assert.ifError(err); diff --git a/test/parallel/test-querystring-escape.js b/test/parallel/test-querystring-escape.js index c62f19a0ae..fd20a8424f 100644 --- a/test/parallel/test-querystring-escape.js +++ b/test/parallel/test-querystring-escape.js @@ -17,16 +17,16 @@ assert.throws(() => qs.escape(String.fromCharCode(0xD800 + 1)), // using toString for objects assert.strictEqual( - qs.escape({test: 5, toString: () => 'test', valueOf: () => 10 }), + qs.escape({ test: 5, toString: () => 'test', valueOf: () => 10 }), 'test' ); // toString is not callable, must throw an error -assert.throws(() => qs.escape({toString: 5}), +assert.throws(() => qs.escape({ toString: 5 }), /^TypeError: Cannot convert object to primitive value$/); // should use valueOf instead of non-callable toString -assert.strictEqual(qs.escape({toString: 5, valueOf: () => 'test'}), 'test'); +assert.strictEqual(qs.escape({ toString: 5, valueOf: () => 'test' }), 'test'); assert.throws(() => qs.escape(Symbol('test')), /^TypeError: Cannot convert a Symbol value to a string$/); diff --git a/test/parallel/test-querystring-maxKeys-non-finite.js b/test/parallel/test-querystring-maxKeys-non-finite.js index da72dbf17c..2db3acff0f 100644 --- a/test/parallel/test-querystring-maxKeys-non-finite.js +++ b/test/parallel/test-querystring-maxKeys-non-finite.js @@ -39,12 +39,18 @@ const params = createManyParams(count); // In this instance split will always return an empty array // this test confirms that the output of parse is the expected length // when passed Infinity as the argument for maxKeys -const resultInfinity = parse(params, undefined, undefined, {maxKeys: Infinity}); -const resultNaN = parse(params, undefined, undefined, {maxKeys: NaN}); +const resultInfinity = parse(params, undefined, undefined, { + maxKeys: Infinity +}); +const resultNaN = parse(params, undefined, undefined, { + maxKeys: NaN +}); const resultInfinityString = parse(params, undefined, undefined, { maxKeys: 'Infinity' }); -const resultNaNString = parse(params, undefined, undefined, {maxKeys: 'NaN'}); +const resultNaNString = parse(params, undefined, undefined, { + maxKeys: 'NaN' +}); // Non Finite maxKeys should return the length of input assert.strictEqual(Object.keys(resultInfinity).length, count); diff --git a/test/parallel/test-querystring-multichar-separator.js b/test/parallel/test-querystring-multichar-separator.js index a518d8da07..720733b1e2 100644 --- a/test/parallel/test-querystring-multichar-separator.js +++ b/test/parallel/test-querystring-multichar-separator.js @@ -12,11 +12,14 @@ function check(actual, expected) { }); } -check(qs.parse('foo=>bar&&bar=>baz', '&&', '=>'), {foo: 'bar', bar: 'baz'}); +check(qs.parse('foo=>bar&&bar=>baz', '&&', '=>'), + { foo: 'bar', bar: 'baz' }); -check(qs.stringify({foo: 'bar', bar: 'baz'}, '&&', '=>'), 'foo=>bar&&bar=>baz'); +check(qs.stringify({ foo: 'bar', bar: 'baz' }, '&&', '=>'), + 'foo=>bar&&bar=>baz'); -check(qs.parse('foo==>bar, bar==>baz', ', ', '==>'), {foo: 'bar', bar: 'baz'}); +check(qs.parse('foo==>bar, bar==>baz', ', ', '==>'), + { foo: 'bar', bar: 'baz' }); -check(qs.stringify({foo: 'bar', bar: 'baz'}, ', ', '==>'), +check(qs.stringify({ foo: 'bar', bar: 'baz' }, ', ', '==>'), 'foo==>bar, bar==>baz'); diff --git a/test/parallel/test-querystring.js b/test/parallel/test-querystring.js index 69fee2d6af..60d66329e5 100644 --- a/test/parallel/test-querystring.js +++ b/test/parallel/test-querystring.js @@ -40,30 +40,30 @@ function createWithNoPrototype(properties) { const qsTestCases = [ ['__proto__=1', '__proto__=1', - createWithNoPrototype([{key: '__proto__', value: '1'}])], + createWithNoPrototype([{ key: '__proto__', value: '1' }])], ['__defineGetter__=asdf', '__defineGetter__=asdf', JSON.parse('{"__defineGetter__":"asdf"}')], ['foo=918854443121279438895193', 'foo=918854443121279438895193', - {'foo': '918854443121279438895193'}], - ['foo=bar', 'foo=bar', {'foo': 'bar'}], - ['foo=bar&foo=quux', 'foo=bar&foo=quux', {'foo': ['bar', 'quux']}], - ['foo=1&bar=2', 'foo=1&bar=2', {'foo': '1', 'bar': '2'}], + { 'foo': '918854443121279438895193' }], + ['foo=bar', 'foo=bar', { 'foo': 'bar' }], + ['foo=bar&foo=quux', 'foo=bar&foo=quux', { 'foo': ['bar', 'quux'] }], + ['foo=1&bar=2', 'foo=1&bar=2', { 'foo': '1', 'bar': '2' }], ['my+weird+field=q1%212%22%27w%245%267%2Fz8%29%3F', 'my%20weird%20field=q1!2%22\'w%245%267%2Fz8)%3F', - {'my weird field': 'q1!2"\'w$5&7/z8)?' }], - ['foo%3Dbaz=bar', 'foo%3Dbaz=bar', {'foo=baz': 'bar'}], - ['foo=baz=bar', 'foo=baz%3Dbar', {'foo': 'baz=bar'}], + { 'my weird field': 'q1!2"\'w$5&7/z8)?' }], + ['foo%3Dbaz=bar', 'foo%3Dbaz=bar', { 'foo=baz': 'bar' }], + ['foo=baz=bar', 'foo=baz%3Dbar', { 'foo': 'baz=bar' }], ['str=foo&arr=1&arr=2&arr=3&somenull=&undef=', 'str=foo&arr=1&arr=2&arr=3&somenull=&undef=', { 'str': 'foo', 'arr': ['1', '2', '3'], 'somenull': '', - 'undef': ''}], - [' foo = bar ', '%20foo%20=%20bar%20', {' foo ': ' bar '}], - ['foo=%zx', 'foo=%25zx', {'foo': '%zx'}], - ['foo=%EF%BF%BD', 'foo=%EF%BF%BD', {'foo': '\ufffd' }], + 'undef': '' }], + [' foo = bar ', '%20foo%20=%20bar%20', { ' foo ': ' bar ' }], + ['foo=%zx', 'foo=%25zx', { 'foo': '%zx' }], + ['foo=%EF%BF%BD', 'foo=%EF%BF%BD', { 'foo': '\ufffd' }], // See: https://github.com/joyent/node/issues/1707 ['hasOwnProperty=x&toString=foo&valueOf=bar&__defineGetter__=baz', 'hasOwnProperty=x&toString=foo&valueOf=bar&__defineGetter__=baz', @@ -81,7 +81,7 @@ const qsTestCases = [ ['&', '', {}], ['&&&&', '', {}], ['&=&', '=', { '': '' }], - ['&=&=', '=&=', { '': [ '', '' ]}], + ['&=&=', '=&=', { '': [ '', '' ] }], ['=', '=', { '': '' }], ['+', '%20=', { ' ': '' }], ['+=', '%20=', { ' ': '' }], @@ -112,35 +112,39 @@ const qsTestCases = [ // [ wonkyQS, canonicalQS, obj ] const qsColonTestCases = [ - ['foo:bar', 'foo:bar', {'foo': 'bar'}], - ['foo:bar;foo:quux', 'foo:bar;foo:quux', {'foo': ['bar', 'quux']}], + ['foo:bar', 'foo:bar', { 'foo': 'bar' }], + ['foo:bar;foo:quux', 'foo:bar;foo:quux', { 'foo': ['bar', 'quux'] }], ['foo:1&bar:2;baz:quux', 'foo:1%26bar%3A2;baz:quux', - {'foo': '1&bar:2', 'baz': 'quux'}], - ['foo%3Abaz:bar', 'foo%3Abaz:bar', {'foo:baz': 'bar'}], - ['foo:baz:bar', 'foo:baz%3Abar', {'foo': 'baz:bar'}] + { 'foo': '1&bar:2', 'baz': 'quux' }], + ['foo%3Abaz:bar', 'foo%3Abaz:bar', { 'foo:baz': 'bar' }], + ['foo:baz:bar', 'foo:baz%3Abar', { 'foo': 'baz:bar' }] ]; // [wonkyObj, qs, canonicalObj] function extendedFunction() {} -extendedFunction.prototype = {a: 'b'}; +extendedFunction.prototype = { a: 'b' }; const qsWeirdObjects = [ // eslint-disable-next-line no-unescaped-regexp-dot - [{regexp: /./g}, 'regexp=', {'regexp': ''}], + [{ regexp: /./g }, 'regexp=', { 'regexp': '' }], // eslint-disable-next-line no-unescaped-regexp-dot - [{regexp: new RegExp('.', 'g')}, 'regexp=', {'regexp': ''}], - [{fn: function() {}}, 'fn=', {'fn': ''}], - [{fn: new Function('')}, 'fn=', {'fn': ''}], - [{math: Math}, 'math=', {'math': ''}], - [{e: extendedFunction}, 'e=', {'e': ''}], - [{d: new Date()}, 'd=', {'d': ''}], - [{d: Date}, 'd=', {'d': ''}], - [{f: new Boolean(false), t: new Boolean(true)}, 'f=&t=', {'f': '', 't': ''}], - [{f: false, t: true}, 'f=false&t=true', {'f': 'false', 't': 'true'}], - [{n: null}, 'n=', {'n': ''}], - [{nan: NaN}, 'nan=', {'nan': ''}], - [{inf: Infinity}, 'inf=', {'inf': ''}], - [{a: [], b: []}, '', {}] + [{ regexp: new RegExp('.', 'g') }, 'regexp=', { 'regexp': '' }], + [{ fn: function() {} }, 'fn=', { 'fn': '' }], + [{ fn: new Function('') }, 'fn=', { 'fn': '' }], + [{ math: Math }, 'math=', { 'math': '' }], + [{ e: extendedFunction }, 'e=', { 'e': '' }], + [{ d: new Date() }, 'd=', { 'd': '' }], + [{ d: Date }, 'd=', { 'd': '' }], + [ + { f: new Boolean(false), t: new Boolean(true) }, + 'f=&t=', + { 'f': '', 't': '' } + ], + [{ f: false, t: true }, 'f=false&t=true', { 'f': 'false', 't': 'true' }], + [{ n: null }, 'n=', { 'n': '' }], + [{ nan: NaN }, 'nan=', { 'nan': '' }], + [{ inf: Infinity }, 'inf=', { 'inf': '' }], + [{ a: [], b: [] }, '', {}] ]; // }}} @@ -149,17 +153,17 @@ const foreignObject = vm.runInNewContext('({"foo": ["bar", "baz"]})'); const qsNoMungeTestCases = [ ['', {}], - ['foo=bar&foo=baz', {'foo': ['bar', 'baz']}], + ['foo=bar&foo=baz', { 'foo': ['bar', 'baz'] }], ['foo=bar&foo=baz', foreignObject], - ['blah=burp', {'blah': 'burp'}], - ['a=!-._~\'()*', {'a': '!-._~\'()*'}], - ['a=abcdefghijklmnopqrstuvwxyz', {'a': 'abcdefghijklmnopqrstuvwxyz'}], - ['a=ABCDEFGHIJKLMNOPQRSTUVWXYZ', {'a': 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}], - ['a=0123456789', {'a': '0123456789'}], - ['gragh=1&gragh=3&goo=2', {'gragh': ['1', '3'], 'goo': '2'}], + ['blah=burp', { 'blah': 'burp' }], + ['a=!-._~\'()*', { 'a': '!-._~\'()*' }], + ['a=abcdefghijklmnopqrstuvwxyz', { 'a': 'abcdefghijklmnopqrstuvwxyz' }], + ['a=ABCDEFGHIJKLMNOPQRSTUVWXYZ', { 'a': 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' }], + ['a=0123456789', { 'a': '0123456789' }], + ['gragh=1&gragh=3&goo=2', { 'gragh': ['1', '3'], 'goo': '2' }], ['frappucino=muffin&goat%5B%5D=scone&pond=moose', - {'frappucino': 'muffin', 'goat[]': 'scone', 'pond': 'moose'}], - ['trololol=yes&lololo=no', {'trololol': 'yes', 'lololo': 'no'}] + { 'frappucino': 'muffin', 'goat[]': 'scone', 'pond': 'moose' }], + ['trololol=yes&lololo=no', { 'trololol': 'yes', 'lololo': 'no' }] ]; const qsUnescapeTestCases = [ @@ -224,14 +228,14 @@ qsNoMungeTestCases.forEach(function(testCase) { { const f = qs.parse('a=b&q=x%3Dy%26y%3Dz'); check(f, createWithNoPrototype([ - { key: 'a', value: 'b'}, - {key: 'q', value: 'x=y&y=z'} + { key: 'a', value: 'b' }, + { key: 'q', value: 'x=y&y=z' } ])); f.q = qs.parse(f.q); const expectedInternal = createWithNoPrototype([ - { key: 'x', value: 'y'}, - {key: 'y', value: 'z' } + { key: 'x', value: 'y' }, + { key: 'y', value: 'z' } ]); check(f.q, expectedInternal); } @@ -240,13 +244,13 @@ qsNoMungeTestCases.forEach(function(testCase) { { const f = qs.parse('a:b;q:x%3Ay%3By%3Az', ';', ':'); check(f, createWithNoPrototype([ - {key: 'a', value: 'b'}, - {key: 'q', value: 'x:y;y:z'} + { key: 'a', value: 'b' }, + { key: 'q', value: 'x:y;y:z' } ])); f.q = qs.parse(f.q, ';', ':'); const expectedInternal = createWithNoPrototype([ - { key: 'x', value: 'y'}, - {key: 'y', value: 'z' } + { key: 'x', value: 'y' }, + { key: 'y', value: 'z' } ]); check(f.q, expectedInternal); } @@ -342,7 +346,7 @@ assert.strictEqual( const url = qs.stringify(query); assert.strictEqual( - Object.keys(qs.parse(url, null, null, {maxKeys: 0})).length, + Object.keys(qs.parse(url, null, null, { maxKeys: 0 })).length, 2000); } @@ -392,10 +396,12 @@ check(qs.parse('%\u0100=%\u0101'), { '%Ā': '%ā' }); return str + str; } - check(qs.parse('a=a&b=b&c=c', null, null, {decodeURIComponent: demoDecode}), - {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': ''}); + check( + qs.parse('a=a&b=b&c=c', null, null, { decodeURIComponent: demoDecode }), + { 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': '' }); } // Test QueryString.unescape @@ -404,8 +410,8 @@ check(qs.parse('%\u0100=%\u0101'), { '%Ā': '%ā' }); throw new Error('To jump to the catch scope'); } - check(qs.parse('a=a', null, null, {decodeURIComponent: errDecode}), - {a: 'a'}); + check(qs.parse('a=a', null, null, { decodeURIComponent: errDecode }), + { a: 'a' }); } // Test custom encode @@ -414,9 +420,9 @@ check(qs.parse('%\u0100=%\u0101'), { '%Ā': '%ā' }); return str[0]; } - const obj = {aa: 'aa', bb: 'bb', cc: 'cc'}; + const obj = { aa: 'aa', bb: 'bb', cc: 'cc' }; assert.strictEqual( - qs.stringify(obj, null, null, {encodeURIComponent: demoEncode}), + qs.stringify(obj, null, null, { encodeURIComponent: demoEncode }), 'a=a&b=b&c=c'); } @@ -434,7 +440,7 @@ qsUnescapeTestCases.forEach(function(testCase) { }; check( qs.parse('foo=bor'), - createWithNoPrototype([{key: 'f__', value: 'b_r'}])); + createWithNoPrototype([{ key: 'f__', value: 'b_r' }])); qs.unescape = prevUnescape; } // test separator and "equals" parsing order diff --git a/test/parallel/test-readline-interface.js b/test/parallel/test-readline-interface.js index 25cd738bf2..9ce978b86e 100644 --- a/test/parallel/test-readline-interface.js +++ b/test/parallel/test-readline-interface.js @@ -57,7 +57,7 @@ function isWarned(emitter) { { // Minimum crlfDelay is 100ms const fi = new FakeInput(); - const rli = new readline.Interface({ input: fi, output: fi, crlfDelay: 0}); + const rli = new readline.Interface({ input: fi, output: fi, crlfDelay: 0 }); assert.strictEqual(rli.crlfDelay, 100); rli.close(); } @@ -91,7 +91,7 @@ function isWarned(emitter) { // default history size 30 fi = new FakeInput(); - rli = new readline.Interface({ input: fi, output: fi, terminal: terminal}); + rli = new readline.Interface({ input: fi, output: fi, terminal: terminal }); assert.strictEqual(rli.historySize, 30); fi.emit('data', 'asdf\n'); @@ -515,7 +515,7 @@ function isWarned(emitter) { //can create a new readline Interface with a null output arugument fi = new FakeInput(); - rli = new readline.Interface({input: fi, output: null, terminal: terminal }); + rli = new readline.Interface({ input: fi, output: null, terminal: terminal }); called = false; rli.on('line', function(line) { diff --git a/test/parallel/test-readline.js b/test/parallel/test-readline.js index 4ec11fe8d8..82bf74549b 100644 --- a/test/parallel/test-readline.js +++ b/test/parallel/test-readline.js @@ -56,20 +56,20 @@ const assert = require('assert'); const key = { xterm: { - home: ['\x1b[H', {ctrl: true, name: 'a'}], - end: ['\x1b[F', {ctrl: true, name: 'e'}], + home: ['\x1b[H', { ctrl: true, name: 'a' }], + end: ['\x1b[F', { ctrl: true, name: 'e' }], }, gnome: { - home: ['\x1bOH', {ctrl: true, name: 'a'}], - end: ['\x1bOF', {ctrl: true, name: 'e'}] + home: ['\x1bOH', { ctrl: true, name: 'a' }], + end: ['\x1bOF', { ctrl: true, name: 'e' }] }, rxvt: { - home: ['\x1b[7', {ctrl: true, name: 'a'}], - end: ['\x1b[8', {ctrl: true, name: 'e'}] + home: ['\x1b[7', { ctrl: true, name: 'a' }], + end: ['\x1b[8', { ctrl: true, name: 'e' }] }, putty: { - home: ['\x1b[1~', {ctrl: true, name: 'a'}], - end: ['\x1b[>~', {ctrl: true, name: 'e'}] + home: ['\x1b[1~', { ctrl: true, name: 'a' }], + end: ['\x1b[>~', { ctrl: true, name: 'e' }] } }; @@ -91,27 +91,27 @@ const assert = require('assert'); const key = { xterm: { - home: ['\x1b[H', {ctrl: true, name: 'a'}], - metab: ['\x1bb', {meta: true, name: 'b'}], - metaf: ['\x1bf', {meta: true, name: 'f'}], + home: ['\x1b[H', { ctrl: true, name: 'a' }], + metab: ['\x1bb', { meta: true, name: 'b' }], + metaf: ['\x1bf', { meta: true, name: 'f' }], } }; rl.write('foo bar.hop/zoo'); rl.write.apply(rl, key.xterm.home); [ - {cursor: 4, key: key.xterm.metaf}, - {cursor: 7, key: key.xterm.metaf}, - {cursor: 8, key: key.xterm.metaf}, - {cursor: 11, key: key.xterm.metaf}, - {cursor: 12, key: key.xterm.metaf}, - {cursor: 15, key: key.xterm.metaf}, - {cursor: 12, key: key.xterm.metab}, - {cursor: 11, key: key.xterm.metab}, - {cursor: 8, key: key.xterm.metab}, - {cursor: 7, key: key.xterm.metab}, - {cursor: 4, key: key.xterm.metab}, - {cursor: 0, key: key.xterm.metab}, + { cursor: 4, key: key.xterm.metaf }, + { cursor: 7, key: key.xterm.metaf }, + { cursor: 8, key: key.xterm.metaf }, + { cursor: 11, key: key.xterm.metaf }, + { cursor: 12, key: key.xterm.metaf }, + { cursor: 15, key: key.xterm.metaf }, + { cursor: 12, key: key.xterm.metab }, + { cursor: 11, key: key.xterm.metab }, + { cursor: 8, key: key.xterm.metab }, + { cursor: 7, key: key.xterm.metab }, + { cursor: 4, key: key.xterm.metab }, + { cursor: 0, key: key.xterm.metab }, ].forEach(function(action) { rl.write.apply(rl, action.key); assert.strictEqual(rl.cursor, action.cursor); @@ -127,8 +127,8 @@ const assert = require('assert'); const key = { xterm: { - home: ['\x1b[H', {ctrl: true, name: 'a'}], - metad: ['\x1bd', {meta: true, name: 'd'}] + home: ['\x1b[H', { ctrl: true, name: 'a' }], + metad: ['\x1bd', { meta: true, name: 'd' }] } }; diff --git a/test/parallel/test-regress-GH-2245.js b/test/parallel/test-regress-GH-2245.js index c5b0ae4982..37260b59e3 100644 --- a/test/parallel/test-regress-GH-2245.js +++ b/test/parallel/test-regress-GH-2245.js @@ -25,4 +25,4 @@ function test() { } -assert.deepStrictEqual(test(), {m: 1}); +assert.deepStrictEqual(test(), { m: 1 }); diff --git a/test/parallel/test-regress-GH-4948.js b/test/parallel/test-regress-GH-4948.js index 5ec79b8685..d4d6360086 100644 --- a/test/parallel/test-regress-GH-4948.js +++ b/test/parallel/test-regress-GH-4948.js @@ -16,8 +16,8 @@ const server = http.createServer(function(serverReq, serverRes) { // normally the use case would be to call an external site // does not require connecting locally or to itself to fail - const r = http.request({hostname: 'localhost', - port: this.address().port}, function(res) { + const r = http.request({ hostname: 'localhost', + port: this.address().port }, function(res) { // required, just needs to be in the client response somewhere serverRes.end(); diff --git a/test/parallel/test-repl-editor.js b/test/parallel/test-repl-editor.js index 678d6d5c6d..091eaec1ab 100644 --- a/test/parallel/test-repl-editor.js +++ b/test/parallel/test-repl-editor.js @@ -10,7 +10,7 @@ const repl = require('repl'); const terminalCode = '\u001b[1G\u001b[0J> \u001b[3G'; const terminalCodeRegex = new RegExp(terminalCode.replace(/\[/g, '\\['), 'g'); -function run({input, output, event, checkTerminalCodes = true}) { +function run({ input, output, event, checkTerminalCodes = true }) { const stream = new common.ArrayStream(); let found = ''; @@ -45,22 +45,22 @@ const tests = [ { input: '', output: '\n(To exit, press ^C again or type .exit)', - event: {ctrl: true, name: 'c'} + event: { ctrl: true, name: 'c' } }, { input: 'var i = 1;', output: '', - event: {ctrl: true, name: 'c'} + event: { ctrl: true, name: 'c' } }, { input: 'var i = 1;\ni + 3', output: '\n4', - event: {ctrl: true, name: 'd'} + event: { ctrl: true, name: 'd' } }, { input: ' var i = 1;\ni + 3', output: '\n4', - event: {ctrl: true, name: 'd'} + event: { ctrl: true, name: 'd' } }, { input: '', @@ -73,7 +73,7 @@ const tests = [ tests.forEach(run); // Auto code alignment for .editor mode -function testCodeAligment({input, cursor = 0, line = ''}) { +function testCodeAligment({ input, cursor = 0, line = '' }) { const stream = new common.ArrayStream(); const outputStream = new common.ArrayStream(); @@ -93,7 +93,7 @@ function testCodeAligment({input, cursor = 0, line = ''}) { assert.strictEqual(line, replServer.line); assert.strictEqual(cursor, replServer.cursor); - replServer.write('', {ctrl: true, name: 'd'}); + replServer.write('', { ctrl: true, name: 'd' }); replServer.close(); // Ensure that empty lines are not saved in history assert.notStrictEqual(replServer.history[0].trim(), ''); diff --git a/test/parallel/test-repl-eval-scope.js b/test/parallel/test-repl-eval-scope.js index b9bace5f7d..00b577cba7 100644 --- a/test/parallel/test-repl-eval-scope.js +++ b/test/parallel/test-repl-eval-scope.js @@ -8,7 +8,7 @@ const repl = require('repl'); const options = { eval: common.mustCall((cmd, context) => { assert.strictEqual(cmd, '.scope\n'); - assert.deepStrictEqual(context, {animal: 'Sterrance'}); + assert.deepStrictEqual(context, { animal: 'Sterrance' }); }), input: stream, output: stream, @@ -16,7 +16,7 @@ const repl = require('repl'); }; const r = repl.start(options); - r.context = {animal: 'Sterrance'}; + r.context = { animal: 'Sterrance' }; stream.emit('data', '\t'); stream.emit('.exit\n'); diff --git a/test/parallel/test-repl-eval.js b/test/parallel/test-repl-eval.js index 7508e14d8b..d775423fb7 100644 --- a/test/parallel/test-repl-eval.js +++ b/test/parallel/test-repl-eval.js @@ -16,7 +16,7 @@ const repl = require('repl'); }; const r = repl.start(options); - r.context = {foo: 'bar'}; + r.context = { foo: 'bar' }; try { // Default preprocessor transforms diff --git a/test/parallel/test-repl-history-perm.js b/test/parallel/test-repl-history-perm.js index 259c96fe8a..5ca8bf57a4 100644 --- a/test/parallel/test-repl-history-perm.js +++ b/test/parallel/test-repl-history-perm.js @@ -45,7 +45,7 @@ const checkResults = common.mustCall(function(err, r) { }); repl.createInternalRepl( - {NODE_REPL_HISTORY: replHistoryPath}, + { NODE_REPL_HISTORY: replHistoryPath }, { terminal: true, input: stream, diff --git a/test/parallel/test-repl-save-load.js b/test/parallel/test-repl-save-load.js index 4ef2a63354..2be272473b 100644 --- a/test/parallel/test-repl-save-load.js +++ b/test/parallel/test-repl-save-load.js @@ -63,7 +63,7 @@ assert.strictEqual(fs.readFileSync(saveFileName, 'utf8'), putIn.run(['.editor']); putIn.run(cmds); - replServer.write('', {ctrl: true, name: 'd'}); + replServer.write('', { ctrl: true, name: 'd' }); putIn.run([`.save ${saveFileName}`]); replServer.close(); diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index 703300b333..59e5b9cc01 100644 --- a/test/parallel/test-repl.js +++ b/test/parallel/test-repl.js @@ -167,7 +167,7 @@ function error_test() { expect: '0.2' }, // Can parse valid JSON { client: client_unix, send: 'JSON.parse(\'{"valid": "json"}\');', - expect: '{ valid: \'json\' }'}, + expect: '{ valid: \'json\' }' }, // invalid input to JSON.parse error is special case of syntax error, // should throw { client: client_unix, send: 'JSON.parse(\'{invalid: \\\'json\\\'}\');', diff --git a/test/parallel/test-require-cache.js b/test/parallel/test-require-cache.js index 098f6fffbb..7b62ab5764 100644 --- a/test/parallel/test-require-cache.js +++ b/test/parallel/test-require-cache.js @@ -28,7 +28,7 @@ const assert = require('assert'); const absolutePath = require.resolve(relativePath); const fakeModule = {}; - require.cache[absolutePath] = {exports: fakeModule}; + require.cache[absolutePath] = { exports: fakeModule }; assert.strictEqual(require(relativePath), fakeModule); } @@ -38,7 +38,7 @@ const assert = require('assert'); const relativePath = 'fs'; const fakeModule = {}; - require.cache[relativePath] = {exports: fakeModule}; + require.cache[relativePath] = { exports: fakeModule }; assert.strictEqual(require(relativePath), fakeModule); } diff --git a/test/parallel/test-require-symlink.js b/test/parallel/test-require-symlink.js index 5608df4eaf..222494aaf1 100644 --- a/test/parallel/test-require-symlink.js +++ b/test/parallel/test-require-symlink.js @@ -59,7 +59,7 @@ function test() { // Also verify that symlinks works for setting preserve via env variables const childEnv = spawn(node, [linkScript], { - env: util._extend(process.env, {NODE_PRESERVE_SYMLINKS: '1'}) + env: util._extend(process.env, { NODE_PRESERVE_SYMLINKS: '1' }) }); childEnv.on('close', function(code, signal) { assert.strictEqual(code, 0); diff --git a/test/parallel/test-stream-big-packet.js b/test/parallel/test-stream-big-packet.js index aeddfb2052..8575c3e43a 100644 --- a/test/parallel/test-stream-big-packet.js +++ b/test/parallel/test-stream-big-packet.js @@ -53,7 +53,7 @@ const s2 = new PassThrough(); const s3 = new TestStream(); s1.pipe(s3); // Don't let s2 auto close which may close s3 -s2.pipe(s3, {end: false}); +s2.pipe(s3, { end: false }); // We must write a buffer larger than highWaterMark const big = Buffer.alloc(s1._writableState.highWaterMark + 1, 'x'); diff --git a/test/parallel/test-stream-pipe-await-drain-manual-resume.js b/test/parallel/test-stream-pipe-await-drain-manual-resume.js index 96360429e5..bd7332c7fa 100644 --- a/test/parallel/test-stream-pipe-await-drain-manual-resume.js +++ b/test/parallel/test-stream-pipe-await-drain-manual-resume.js @@ -15,7 +15,7 @@ const queue = []; writable._write = (chunk, encoding, cb) => { if (isCurrentlyBufferingWrites) - queue.push({chunk, cb}); + queue.push({ chunk, cb }); else cb(); }; diff --git a/test/parallel/test-stream-pipe-unpipe-streams.js b/test/parallel/test-stream-pipe-unpipe-streams.js index 916bd2cdfa..cd29b66365 100644 --- a/test/parallel/test-stream-pipe-unpipe-streams.js +++ b/test/parallel/test-stream-pipe-unpipe-streams.js @@ -4,9 +4,9 @@ const assert = require('assert'); const { Readable, Writable } = require('stream'); -const source = Readable({read: () => {}}); -const dest1 = Writable({write: () => {}}); -const dest2 = Writable({write: () => {}}); +const source = Readable({ read: () => {} }); +const dest1 = Writable({ write: () => {} }); +const dest2 = Writable({ write: () => {} }); source.pipe(dest1); source.pipe(dest2); diff --git a/test/parallel/test-stream-unpipe-event.js b/test/parallel/test-stream-unpipe-event.js index befa24253d..340502d1a9 100644 --- a/test/parallel/test-stream-unpipe-event.js +++ b/test/parallel/test-stream-unpipe-event.js @@ -1,7 +1,7 @@ 'use strict'; const common = require('../common'); const assert = require('assert'); -const {Writable, Readable} = require('stream'); +const { Writable, Readable } = require('stream'); class NullWriteable extends Writable { _write(chunk, encoding, callback) { return callback(); @@ -55,7 +55,7 @@ class NeverEndReadable extends Readable { const src = new QuickEndReadable(); dest.on('pipe', common.mustCall()); dest.on('unpipe', common.mustCall()); - src.pipe(dest, {end: false}); + src.pipe(dest, { end: false }); setImmediate(() => { assert.strictEqual(src._readableState.pipesCount, 0); }); @@ -66,7 +66,7 @@ class NeverEndReadable extends Readable { const src = new NeverEndReadable(); dest.on('pipe', common.mustCall()); dest.on('unpipe', common.mustNotCall('unpipe should not have been emitted')); - src.pipe(dest, {end: false}); + src.pipe(dest, { end: false }); setImmediate(() => { assert.strictEqual(src._readableState.pipesCount, 1); }); @@ -77,7 +77,7 @@ class NeverEndReadable extends Readable { const src = new NeverEndReadable(); dest.on('pipe', common.mustCall()); dest.on('unpipe', common.mustCall()); - src.pipe(dest, {end: false}); + src.pipe(dest, { end: false }); src.unpipe(dest); setImmediate(() => { assert.strictEqual(src._readableState.pipesCount, 0); diff --git a/test/parallel/test-stream-writable-null.js b/test/parallel/test-stream-writable-null.js index 0bb8aa7bbc..58b61bfdc1 100644 --- a/test/parallel/test-stream-writable-null.js +++ b/test/parallel/test-stream-writable-null.js @@ -17,11 +17,11 @@ MyWritable.prototype._write = function(chunk, encoding, callback) { }; assert.throws(() => { - const m = new MyWritable({objectMode: true}); + const m = new MyWritable({ objectMode: true }); m.write(null, (err) => assert.ok(err)); }, /^TypeError: May not write null values to stream$/); assert.doesNotThrow(() => { - const m = new MyWritable({objectMode: true}).on('error', (e) => { + const m = new MyWritable({ objectMode: true }).on('error', (e) => { assert.ok(e); }); m.write(null, (err) => { @@ -43,11 +43,11 @@ assert.doesNotThrow(() => { }); assert.doesNotThrow(() => { - const m = new MyWritable({objectMode: true}); + const m = new MyWritable({ objectMode: true }); m.write(false, (err) => assert.ifError(err)); }); assert.doesNotThrow(() => { - const m = new MyWritable({objectMode: true}).on('error', (e) => { + const m = new MyWritable({ objectMode: true }).on('error', (e) => { assert.ifError(e || new Error('should not get here')); }); m.write(false, (err) => { diff --git a/test/parallel/test-stream-writev.js b/test/parallel/test-stream-writev.js index 24da71c8cf..b179e9ee63 100644 --- a/test/parallel/test-stream-writev.js +++ b/test/parallel/test-stream-writev.js @@ -71,7 +71,7 @@ function test(decode, uncork, multi, next) { { encoding: 'buffer', chunk: [10, 97, 110, 100, 32, 116, 104, 101, 110, 46, 46, 46] }, { encoding: 'buffer', - chunk: [250, 206, 190, 167, 222, 173, 190, 239, 222, 202, 251, 173]} + chunk: [250, 206, 190, 167, 222, 173, 190, 239, 222, 202, 251, 173] } ] : [ { encoding: 'ascii', chunk: 'hello, ' }, { encoding: 'utf8', chunk: 'world' }, diff --git a/test/parallel/test-stream2-base64-single-char-read-end.js b/test/parallel/test-stream2-base64-single-char-read-end.js index 3c946f3b2f..10259e2804 100644 --- a/test/parallel/test-stream2-base64-single-char-read-end.js +++ b/test/parallel/test-stream2-base64-single-char-read-end.js @@ -25,7 +25,7 @@ const R = require('_stream_readable'); const W = require('_stream_writable'); const assert = require('assert'); -const src = new R({encoding: 'base64'}); +const src = new R({ encoding: 'base64' }); const dst = new W(); let hasRead = false; const accum = []; diff --git a/test/parallel/test-stream2-httpclient-response-end.js b/test/parallel/test-stream2-httpclient-response-end.js index 6d3da191b0..27d31e50a9 100644 --- a/test/parallel/test-stream2-httpclient-response-end.js +++ b/test/parallel/test-stream2-httpclient-response-end.js @@ -4,10 +4,10 @@ const assert = require('assert'); const http = require('http'); const msg = 'Hello'; const server = http.createServer(function(req, res) { - res.writeHead(200, {'Content-Type': 'text/plain'}); + res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end(msg); }).listen(0, function() { - http.get({port: this.address().port}, function(res) { + http.get({ port: this.address().port }, function(res) { let data = ''; res.on('readable', common.mustCall(function() { console.log('readable event'); diff --git a/test/parallel/test-stream2-objects.js b/test/parallel/test-stream2-objects.js index 901f946a93..f58ea4a32a 100644 --- a/test/parallel/test-stream2-objects.js +++ b/test/parallel/test-stream2-objects.js @@ -53,7 +53,7 @@ function fromArray(list) { { // Verify that objects can be read from the stream - const r = fromArray([{ one: '1'}, { two: '2' }]); + const r = fromArray([{ one: '1' }, { two: '2' }]); const v1 = r.read(); const v2 = r.read(); @@ -66,7 +66,7 @@ function fromArray(list) { { // Verify that objects can be piped into the stream - const r = fromArray([{ one: '1'}, { two: '2' }]); + const r = fromArray([{ one: '1' }, { two: '2' }]); r.pipe(toArray(common.mustCall(function(list) { assert.deepStrictEqual(list, [ @@ -78,7 +78,7 @@ function fromArray(list) { { // Verify that read(n) is ignored - const r = fromArray([{ one: '1'}, { two: '2' }]); + const r = fromArray([{ one: '1' }, { two: '2' }]); const value = r.read(2); assert.deepStrictEqual(value, { one: '1' }); @@ -87,7 +87,7 @@ function fromArray(list) { { // Verify that objects can be synchronously read const r = new Readable({ objectMode: true }); - const list = [{ one: '1'}, { two: '2' }]; + const list = [{ one: '1' }, { two: '2' }]; r._read = function(n) { const item = list.shift(); r.push(item || null); @@ -104,7 +104,7 @@ function fromArray(list) { { // Verify that objects can be asynchronously read const r = new Readable({ objectMode: true }); - const list = [{ one: '1'}, { two: '2' }]; + const list = [{ one: '1' }, { two: '2' }]; r._read = function(n) { const item = list.shift(); process.nextTick(function() { diff --git a/test/parallel/test-stream2-transform.js b/test/parallel/test-stream2-transform.js index 6b5593d93b..0f12476f50 100644 --- a/test/parallel/test-stream2-transform.js +++ b/test/parallel/test-stream2-transform.js @@ -77,7 +77,7 @@ const Transform = require('_stream_transform'); pt.write(0); pt.write('foo'); pt.write(''); - pt.write({ a: 'b'}); + pt.write({ a: 'b' }); pt.end(); assert.strictEqual(pt.read(), 1); @@ -86,7 +86,7 @@ const Transform = require('_stream_transform'); assert.strictEqual(pt.read(), 0); assert.strictEqual(pt.read(), 'foo'); assert.strictEqual(pt.read(), ''); - assert.deepStrictEqual(pt.read(), { a: 'b'}); + assert.deepStrictEqual(pt.read(), { a: 'b' }); } { @@ -131,7 +131,7 @@ const Transform = require('_stream_transform'); pt.write(0); pt.write('foo'); pt.write(''); - pt.write({ a: 'b'}); + pt.write({ a: 'b' }); pt.end(); assert.strictEqual(pt.read(), '1'); @@ -258,7 +258,7 @@ const Transform = require('_stream_transform'); // Verify compex transform behavior let count = 0; let saved = null; - const pt = new Transform({highWaterMark: 3}); + const pt = new Transform({ highWaterMark: 3 }); pt._transform = function(c, e, cb) { if (count++ === 1) saved = c; diff --git a/test/parallel/test-timers-active.js b/test/parallel/test-timers-active.js index 62707cf18c..a98d32c0b0 100644 --- a/test/parallel/test-timers-active.js +++ b/test/parallel/test-timers-active.js @@ -30,5 +30,5 @@ bogusTimers.forEach(function(bogus) { const savedTimeout = bogus._idleTimeout; active(bogus); // active() should not mutate these objects - assert.deepStrictEqual(bogus, {_idleTimeout: savedTimeout}); + assert.deepStrictEqual(bogus, { _idleTimeout: savedTimeout }); }); diff --git a/test/parallel/test-timers-throw-when-cb-not-function.js b/test/parallel/test-timers-throw-when-cb-not-function.js index 4e866726c1..7751f0fb2e 100644 --- a/test/parallel/test-timers-throw-when-cb-not-function.js +++ b/test/parallel/test-timers-throw-when-cb-not-function.js @@ -11,7 +11,7 @@ function doSetTimeout(callback, after) { const errMessage = /"callback" argument must be a function/; assert.throws(doSetTimeout('foo'), errMessage); -assert.throws(doSetTimeout({foo: 'bar'}), errMessage); +assert.throws(doSetTimeout({ foo: 'bar' }), errMessage); assert.throws(doSetTimeout(), errMessage); assert.throws(doSetTimeout(undefined, 0), errMessage); assert.throws(doSetTimeout(null, 0), errMessage); @@ -25,7 +25,7 @@ function doSetInterval(callback, after) { } assert.throws(doSetInterval('foo'), errMessage); -assert.throws(doSetInterval({foo: 'bar'}), errMessage); +assert.throws(doSetInterval({ foo: 'bar' }), errMessage); assert.throws(doSetInterval(), errMessage); assert.throws(doSetInterval(undefined, 0), errMessage); assert.throws(doSetInterval(null, 0), errMessage); @@ -39,7 +39,7 @@ function doSetImmediate(callback, after) { } assert.throws(doSetImmediate('foo'), errMessage); -assert.throws(doSetImmediate({foo: 'bar'}), errMessage); +assert.throws(doSetImmediate({ foo: 'bar' }), errMessage); assert.throws(doSetImmediate(), errMessage); assert.throws(doSetImmediate(undefined, 0), errMessage); assert.throws(doSetImmediate(null, 0), errMessage); diff --git a/test/parallel/test-tls-alpn-server-client.js b/test/parallel/test-tls-alpn-server-client.js index 56f925b8a9..e7cf62fe04 100644 --- a/test/parallel/test-tls-alpn-server-client.js +++ b/test/parallel/test-tls-alpn-server-client.js @@ -37,7 +37,7 @@ function runTest(clientsOptions, serverOptions, cb) { const results = []; let index = 0; const server = tls.createServer(serverOptions, function(c) { - results[index].server = {ALPN: c.alpnProtocol, NPN: c.npnProtocol}; + results[index].server = { ALPN: c.alpnProtocol, NPN: c.npnProtocol }; }); server.listen(0, serverIP, function() { @@ -52,8 +52,8 @@ function runTest(clientsOptions, serverOptions, cb) { results[index] = {}; const client = tls.connect(opt, function() { - results[index].client = {ALPN: client.alpnProtocol, - NPN: client.npnProtocol}; + results[index].client = { ALPN: client.alpnProtocol, + NPN: client.npnProtocol }; client.destroy(); if (options.length) { index++; @@ -88,16 +88,16 @@ function Test1() { runTest(clientsOptions, serverOptions, function(results) { // 'a' is selected by ALPN checkResults(results[0], - {server: {ALPN: 'a', NPN: false}, - client: {ALPN: 'a', NPN: undefined}}); + { server: { ALPN: 'a', NPN: false }, + client: { ALPN: 'a', NPN: undefined } }); // 'b' is selected by ALPN checkResults(results[1], - {server: {ALPN: 'b', NPN: false}, - client: {ALPN: 'b', NPN: undefined}}); + { server: { ALPN: 'b', NPN: false }, + client: { ALPN: 'b', NPN: undefined } }); // nothing is selected by ALPN checkResults(results[2], - {server: {ALPN: false, NPN: 'first-priority-unsupported'}, - client: {ALPN: false, NPN: false}}); + { server: { ALPN: false, NPN: 'first-priority-unsupported' }, + client: { ALPN: false, NPN: false } }); // execute next test Test2(); }); @@ -121,16 +121,16 @@ function Test2() { runTest(clientsOptions, serverOptions, function(results) { // 'a' is selected by ALPN checkResults(results[0], - {server: {ALPN: 'a', NPN: false}, - client: {ALPN: 'a', NPN: undefined}}); + { server: { ALPN: 'a', NPN: false }, + client: { ALPN: 'a', NPN: undefined } }); // 'b' is selected by ALPN checkResults(results[1], - {server: {ALPN: 'b', NPN: false}, - client: {ALPN: 'b', NPN: undefined}}); + { server: { ALPN: 'b', NPN: false }, + client: { ALPN: 'b', NPN: undefined } }); // nothing is selected by ALPN checkResults(results[2], - {server: {ALPN: false, NPN: 'http/1.1'}, - client: {ALPN: false, NPN: false}}); + { server: { ALPN: false, NPN: 'http/1.1' }, + client: { ALPN: false, NPN: false } }); // execute next test Test3(); }); @@ -154,16 +154,16 @@ function Test3() { runTest(clientsOptions, serverOptions, function(results) { // 'a' is selected by NPN checkResults(results[0], - {server: {ALPN: false, NPN: 'a'}, - client: {ALPN: false, NPN: 'a'}}); + { server: { ALPN: false, NPN: 'a' }, + client: { ALPN: false, NPN: 'a' } }); // nothing is selected by ALPN checkResults(results[1], - {server: {ALPN: false, NPN: 'http/1.1'}, - client: {ALPN: false, NPN: false}}); + { server: { ALPN: false, NPN: 'http/1.1' }, + client: { ALPN: false, NPN: false } }); // nothing is selected by ALPN checkResults(results[2], - {server: {ALPN: false, NPN: 'http/1.1'}, - client: {ALPN: false, NPN: false}}); + { server: { ALPN: false, NPN: 'http/1.1' }, + client: { ALPN: false, NPN: false } }); // execute next test Test4(); }); @@ -181,16 +181,16 @@ function Test4() { runTest(clientsOptions, serverOptions, function(results) { // nothing is selected by ALPN checkResults(results[0], - {server: {ALPN: false, NPN: 'http/1.1'}, - client: {ALPN: false, NPN: false}}); + { server: { ALPN: false, NPN: 'http/1.1' }, + client: { ALPN: false, NPN: false } }); // nothing is selected by ALPN checkResults(results[1], - {server: {ALPN: false, NPN: 'http/1.1'}, - client: {ALPN: false, NPN: false}}); + { server: { ALPN: false, NPN: 'http/1.1' }, + client: { ALPN: false, NPN: false } }); // nothing is selected by ALPN checkResults(results[2], - {server: {ALPN: false, NPN: 'http/1.1'}, - client: {ALPN: false, NPN: false}}); + { server: { ALPN: false, NPN: 'http/1.1' }, + client: { ALPN: false, NPN: false } }); // execute next test Test5(); }); @@ -215,15 +215,15 @@ function Test5() { runTest(clientsOptions, serverOptions, function(results) { // 'a' is selected by ALPN - checkResults(results[0], {server: {ALPN: 'a', NPN: false}, - client: {ALPN: 'a', NPN: undefined}}); + checkResults(results[0], { server: { ALPN: 'a', NPN: false }, + client: { ALPN: 'a', NPN: undefined } }); // 'b' is selected by ALPN - checkResults(results[1], {server: {ALPN: 'b', NPN: false}, - client: {ALPN: 'b', NPN: undefined}}); + checkResults(results[1], { server: { ALPN: 'b', NPN: false }, + client: { ALPN: 'b', NPN: undefined } }); // nothing is selected by ALPN - checkResults(results[2], {server: {ALPN: false, - NPN: 'first-priority-unsupported'}, - client: {ALPN: false, NPN: false}}); + checkResults(results[2], { server: { ALPN: false, + NPN: 'first-priority-unsupported' }, + client: { ALPN: false, NPN: false } }); // execute next test Test6(); }); @@ -245,14 +245,14 @@ function Test6() { runTest(clientsOptions, serverOptions, function(results) { // 'a' is selected by ALPN - checkResults(results[0], {server: {ALPN: 'a', NPN: false}, - client: {ALPN: 'a', NPN: undefined}}); + checkResults(results[0], { server: { ALPN: 'a', NPN: false }, + client: { ALPN: 'a', NPN: undefined } }); // 'b' is selected by ALPN - checkResults(results[1], {server: {ALPN: 'b', NPN: false}, - client: {ALPN: 'b', NPN: undefined}}); + checkResults(results[1], { server: { ALPN: 'b', NPN: false }, + client: { ALPN: 'b', NPN: undefined } }); // nothing is selected by ALPN - checkResults(results[2], {server: {ALPN: false, NPN: 'http/1.1'}, - client: {ALPN: false, NPN: false}}); + checkResults(results[2], { server: { ALPN: false, NPN: 'http/1.1' }, + client: { ALPN: false, NPN: false } }); // execute next test Test7(); }); @@ -274,15 +274,15 @@ function Test7() { runTest(clientsOptions, serverOptions, function(results) { // nothing is selected by ALPN - checkResults(results[0], {server: {ALPN: false, NPN: 'a'}, - client: {ALPN: false, NPN: false}}); + checkResults(results[0], { server: { ALPN: false, NPN: 'a' }, + client: { ALPN: false, NPN: false } }); // nothing is selected by ALPN - checkResults(results[1], {server: {ALPN: false, NPN: 'c'}, - client: {ALPN: false, NPN: false}}); + checkResults(results[1], { server: { ALPN: false, NPN: 'c' }, + client: { ALPN: false, NPN: false } }); // nothing is selected by ALPN checkResults(results[2], - {server: {ALPN: false, NPN: 'first-priority-unsupported'}, - client: {ALPN: false, NPN: false}}); + { server: { ALPN: false, NPN: 'first-priority-unsupported' }, + client: { ALPN: false, NPN: false } }); // execute next test Test8(); }); @@ -298,15 +298,15 @@ function Test8() { runTest(clientsOptions, serverOptions, function(results) { // nothing is selected by ALPN - checkResults(results[0], {server: {ALPN: false, NPN: 'http/1.1'}, - client: {ALPN: false, NPN: false}}); + checkResults(results[0], { server: { ALPN: false, NPN: 'http/1.1' }, + client: { ALPN: false, NPN: false } }); // nothing is selected by ALPN - checkResults(results[1], {server: {ALPN: false, NPN: 'http/1.1'}, - client: {ALPN: false, NPN: false}}); + checkResults(results[1], { server: { ALPN: false, NPN: 'http/1.1' }, + client: { ALPN: false, NPN: false } }); // nothing is selected by ALPN checkResults(results[2], - {server: {ALPN: false, NPN: 'http/1.1'}, - client: {ALPN: false, NPN: false}}); + { server: { ALPN: false, NPN: 'http/1.1' }, + client: { ALPN: false, NPN: false } }); // execute next test Test9(); }); @@ -331,15 +331,15 @@ function Test9() { runTest(clientsOptions, serverOptions, function(results) { // 'a' is selected by NPN - checkResults(results[0], {server: {ALPN: false, NPN: 'a'}, - client: {ALPN: false, NPN: 'a'}}); + checkResults(results[0], { server: { ALPN: false, NPN: 'a' }, + client: { ALPN: false, NPN: 'a' } }); // 'b' is selected by NPN - checkResults(results[1], {server: {ALPN: false, NPN: 'b'}, - client: {ALPN: false, NPN: 'b'}}); + checkResults(results[1], { server: { ALPN: false, NPN: 'b' }, + client: { ALPN: false, NPN: 'b' } }); // nothing is selected checkResults(results[2], - {server: {ALPN: false, NPN: 'first-priority-unsupported'}, - client: {ALPN: false, NPN: false}}); + { server: { ALPN: false, NPN: 'first-priority-unsupported' }, + client: { ALPN: false, NPN: false } }); // execute next test Test10(); }); @@ -361,14 +361,14 @@ function Test10() { runTest(clientsOptions, serverOptions, function(results) { // nothing is selected - checkResults(results[0], {server: {ALPN: false, NPN: 'http/1.1'}, - client: {ALPN: false, NPN: false}}); + checkResults(results[0], { server: { ALPN: false, NPN: 'http/1.1' }, + client: { ALPN: false, NPN: false } }); // nothing is selected - checkResults(results[1], {server: {ALPN: false, NPN: 'http/1.1'}, - client: {ALPN: false, NPN: false}}); + checkResults(results[1], { server: { ALPN: false, NPN: 'http/1.1' }, + client: { ALPN: false, NPN: false } }); // nothing is selected - checkResults(results[2], {server: {ALPN: false, NPN: 'http/1.1'}, - client: {ALPN: false, NPN: false}}); + checkResults(results[2], { server: { ALPN: false, NPN: 'http/1.1' }, + client: { ALPN: false, NPN: false } }); // execute next test Test11(); }); @@ -390,15 +390,15 @@ function Test11() { runTest(clientsOptions, serverOptions, function(results) { // 'a' is selected by NPN - checkResults(results[0], {server: {ALPN: false, NPN: 'a'}, - client: {ALPN: false, NPN: 'a'}}); + checkResults(results[0], { server: { ALPN: false, NPN: 'a' }, + client: { ALPN: false, NPN: 'a' } }); // 'b' is selected by NPN - checkResults(results[1], {server: {ALPN: false, NPN: 'b'}, - client: {ALPN: false, NPN: 'b'}}); + checkResults(results[1], { server: { ALPN: false, NPN: 'b' }, + client: { ALPN: false, NPN: 'b' } }); // nothing is selected checkResults(results[2], - {server: {ALPN: false, NPN: 'first-priority-unsupported'}, - client: {ALPN: false, NPN: false}}); + { server: { ALPN: false, NPN: 'first-priority-unsupported' }, + client: { ALPN: false, NPN: false } }); // execute next test Test12(); }); @@ -414,15 +414,15 @@ function Test12() { runTest(clientsOptions, serverOptions, function(results) { // nothing is selected - checkResults(results[0], {server: {ALPN: false, NPN: 'http/1.1'}, - client: {ALPN: false, NPN: false}}); + checkResults(results[0], { server: { ALPN: false, NPN: 'http/1.1' }, + client: { ALPN: false, NPN: false } }); // nothing is selected - checkResults(results[1], {server: {ALPN: false, NPN: 'http/1.1'}, - client: {ALPN: false, NPN: false}}); + checkResults(results[1], { server: { ALPN: false, NPN: 'http/1.1' }, + client: { ALPN: false, NPN: false } }); // nothing is selected checkResults(results[2], - {server: {ALPN: false, NPN: 'http/1.1'}, - client: {ALPN: false, NPN: false}}); + { server: { ALPN: false, NPN: 'http/1.1' }, + client: { ALPN: false, NPN: false } }); // execute next test Test13(); }); @@ -445,15 +445,15 @@ function Test13() { runTest(clientsOptions, serverOptions, function(results) { // nothing is selected - checkResults(results[0], {server: {ALPN: false, NPN: 'a'}, - client: {ALPN: false, NPN: false}}); + checkResults(results[0], { server: { ALPN: false, NPN: 'a' }, + client: { ALPN: false, NPN: false } }); // nothing is selected - checkResults(results[1], {server: {ALPN: false, NPN: 'c'}, - client: {ALPN: false, NPN: false}}); + checkResults(results[1], { server: { ALPN: false, NPN: 'c' }, + client: { ALPN: false, NPN: false } }); // nothing is selected checkResults(results[2], - {server: {ALPN: false, NPN: 'first-priority-unsupported'}, - client: {ALPN: false, NPN: false}}); + { server: { ALPN: false, NPN: 'first-priority-unsupported' }, + client: { ALPN: false, NPN: false } }); // execute next test Test14(); }); @@ -473,15 +473,15 @@ function Test14() { runTest(clientsOptions, serverOptions, function(results) { // nothing is selected - checkResults(results[0], {server: {ALPN: false, NPN: 'http/1.1'}, - client: {ALPN: false, NPN: false}}); + checkResults(results[0], { server: { ALPN: false, NPN: 'http/1.1' }, + client: { ALPN: false, NPN: false } }); // nothing is selected - checkResults(results[1], {server: {ALPN: false, NPN: 'http/1.1'}, - client: {ALPN: false, NPN: false}}); + checkResults(results[1], { server: { ALPN: false, NPN: 'http/1.1' }, + client: { ALPN: false, NPN: false } }); // nothing is selected checkResults(results[2], - {server: {ALPN: false, NPN: 'http/1.1'}, - client: {ALPN: false, NPN: false}}); + { server: { ALPN: false, NPN: 'http/1.1' }, + client: { ALPN: false, NPN: false } }); // execute next test Test15(); }); @@ -501,15 +501,15 @@ function Test15() { runTest(clientsOptions, serverOptions, function(results) { // nothing is selected - checkResults(results[0], {server: {ALPN: false, NPN: 'a'}, - client: {ALPN: false, NPN: false}}); + checkResults(results[0], { server: { ALPN: false, NPN: 'a' }, + client: { ALPN: false, NPN: false } }); // nothing is selected - checkResults(results[1], {server: {ALPN: false, NPN: 'c'}, - client: {ALPN: false, NPN: false}}); + checkResults(results[1], { server: { ALPN: false, NPN: 'c' }, + client: { ALPN: false, NPN: false } }); // nothing is selected checkResults(results[2], - {server: {ALPN: false, NPN: 'first-priority-unsupported'}, - client: {ALPN: false, NPN: false}}); + { server: { ALPN: false, NPN: 'first-priority-unsupported' }, + client: { ALPN: false, NPN: false } }); // execute next test Test16(); }); @@ -523,15 +523,15 @@ function Test16() { runTest(clientsOptions, serverOptions, function(results) { // nothing is selected - checkResults(results[0], {server: {ALPN: false, NPN: 'http/1.1'}, - client: {ALPN: false, NPN: false}}); + checkResults(results[0], { server: { ALPN: false, NPN: 'http/1.1' }, + client: { ALPN: false, NPN: false } }); // nothing is selected - checkResults(results[1], {server: {ALPN: false, NPN: 'http/1.1'}, - client: {ALPN: false, NPN: false}}); + checkResults(results[1], { server: { ALPN: false, NPN: 'http/1.1' }, + client: { ALPN: false, NPN: false } }); // nothing is selected checkResults(results[2], - {server: {ALPN: false, NPN: 'http/1.1'}, - client: {ALPN: false, NPN: false}}); + { server: { ALPN: false, NPN: 'http/1.1' }, + client: { ALPN: false, NPN: false } }); }); } diff --git a/test/parallel/test-tls-basic-validations.js b/test/parallel/test-tls-basic-validations.js index 5866eceec4..a41611020e 100644 --- a/test/parallel/test-tls-basic-validations.js +++ b/test/parallel/test-tls-basic-validations.js @@ -7,22 +7,22 @@ if (!common.hasCrypto) const assert = require('assert'); const tls = require('tls'); -assert.throws(() => tls.createSecureContext({ciphers: 1}), +assert.throws(() => tls.createSecureContext({ ciphers: 1 }), /TypeError: Ciphers must be a string/); -assert.throws(() => tls.createServer({ciphers: 1}), +assert.throws(() => tls.createServer({ ciphers: 1 }), /TypeError: Ciphers must be a string/); -assert.throws(() => tls.createSecureContext({key: 'dummykey', passphrase: 1}), +assert.throws(() => tls.createSecureContext({ key: 'dummykey', passphrase: 1 }), /TypeError: Pass phrase must be a string/); -assert.throws(() => tls.createServer({key: 'dummykey', passphrase: 1}), +assert.throws(() => tls.createServer({ key: 'dummykey', passphrase: 1 }), /TypeError: Pass phrase must be a string/); -assert.throws(() => tls.createServer({ecdhCurve: 1}), +assert.throws(() => tls.createServer({ ecdhCurve: 1 }), /TypeError: ECDH curve name must be a string/); -assert.throws(() => tls.createServer({handshakeTimeout: 'abcd'}), +assert.throws(() => tls.createServer({ handshakeTimeout: 'abcd' }), common.expectsError({ code: 'ERR_INVALID_ARG_TYPE', type: TypeError, @@ -30,13 +30,13 @@ assert.throws(() => tls.createServer({handshakeTimeout: 'abcd'}), }) ); -assert.throws(() => tls.createServer({sessionTimeout: 'abcd'}), +assert.throws(() => tls.createServer({ sessionTimeout: 'abcd' }), /TypeError: Session timeout must be a 32-bit integer/); -assert.throws(() => tls.createServer({ticketKeys: 'abcd'}), +assert.throws(() => tls.createServer({ ticketKeys: 'abcd' }), /TypeError: Ticket keys must be a buffer/); -assert.throws(() => tls.createServer({ticketKeys: Buffer.alloc(0)}), +assert.throws(() => tls.createServer({ ticketKeys: Buffer.alloc(0) }), /TypeError: Ticket keys length must be 48 bytes/); assert.throws(() => tls.createSecurePair({}), diff --git a/test/parallel/test-tls-client-abort.js b/test/parallel/test-tls-client-abort.js index 14f96104e1..f2e9cf6f1c 100644 --- a/test/parallel/test-tls-client-abort.js +++ b/test/parallel/test-tls-client-abort.js @@ -32,7 +32,7 @@ const path = require('path'); const cert = fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem')); const key = fs.readFileSync(path.join(common.fixturesDir, 'test_key.pem')); -const conn = tls.connect({cert, key, port: 0}, common.mustNotCall()); +const conn = tls.connect({ cert, key, port: 0 }, common.mustNotCall()); conn.on('error', function() { }); assert.doesNotThrow(function() { diff --git a/test/parallel/test-tls-connect-address-family.js b/test/parallel/test-tls-connect-address-family.js index afacd5a390..663e9399b6 100644 --- a/test/parallel/test-tls-connect-address-family.js +++ b/test/parallel/test-tls-connect-address-family.js @@ -30,7 +30,7 @@ function runTest() { })); } -dns.lookup('localhost', {family: 6, all: true}, (err, addresses) => { +dns.lookup('localhost', { family: 6, all: true }, (err, addresses) => { if (err) { if (err.code === 'ENOTFOUND') common.skip('localhost does not resolve to ::1'); diff --git a/test/parallel/test-tls-connect.js b/test/parallel/test-tls-connect.js index 5e73196bc1..4b938e49bf 100644 --- a/test/parallel/test-tls-connect.js +++ b/test/parallel/test-tls-connect.js @@ -35,7 +35,7 @@ const path = require('path'); const cert = fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem')); const key = fs.readFileSync(path.join(common.fixturesDir, 'test_key.pem')); - const options = {cert: cert, key: key, port: common.PORT}; + const options = { cert: cert, key: key, port: common.PORT }; const conn = tls.connect(options, common.mustNotCall()); conn.on('error', common.mustCall()); diff --git a/test/parallel/test-tls-delayed-attach-error.js b/test/parallel/test-tls-delayed-attach-error.js index 9d37f15efe..ab153276b1 100644 --- a/test/parallel/test-tls-delayed-attach-error.js +++ b/test/parallel/test-tls-delayed-attach-error.js @@ -30,7 +30,7 @@ const server = net.createServer(common.mustCall(function(c) { }); }), 200); })).listen(0, function() { - const c = net.connect({port: this.address().port}, function() { + const c = net.connect({ port: this.address().port }, function() { c.write(bonkers); }); }); diff --git a/test/parallel/test-tls-env-extra-ca.js b/test/parallel/test-tls-env-extra-ca.js index be7c826b85..6d693fbc81 100644 --- a/test/parallel/test-tls-env-extra-ca.js +++ b/test/parallel/test-tls-env-extra-ca.js @@ -38,7 +38,7 @@ const server = tls.createServer(options, common.mustCall(function(s) { NODE_EXTRA_CA_CERTS: `${common.fixturesDir}/keys/ca1-cert.pem`, }; - fork(__filename, {env: env}).on('exit', common.mustCall(function(status) { + fork(__filename, { env: env }).on('exit', common.mustCall(function(status) { assert.strictEqual(status, 0, 'client did not succeed in connecting'); })); })); diff --git a/test/parallel/test-tls-passphrase.js b/test/parallel/test-tls-passphrase.js index c8cc06d35e..29fdb72246 100644 --- a/test/parallel/test-tls-passphrase.js +++ b/test/parallel/test-tls-passphrase.js @@ -149,14 +149,14 @@ server.listen(0, common.mustCall(function() { // Object[] tls.connect({ port: this.address().port, - key: [{pem: passKey, passphrase: 'passphrase'}], + key: [{ pem: passKey, passphrase: 'passphrase' }], cert: cert, rejectUnauthorized: false }, common.mustCall()); tls.connect({ port: this.address().port, - key: [{pem: passKey, passphrase: 'passphrase'}], + key: [{ pem: passKey, passphrase: 'passphrase' }], passphrase: 'ignored', cert: cert, rejectUnauthorized: false @@ -164,7 +164,7 @@ server.listen(0, common.mustCall(function() { tls.connect({ port: this.address().port, - key: [{pem: passKey}], + key: [{ pem: passKey }], passphrase: 'passphrase', cert: cert, rejectUnauthorized: false @@ -172,28 +172,28 @@ server.listen(0, common.mustCall(function() { tls.connect({ port: this.address().port, - key: [{pem: passKey.toString(), passphrase: 'passphrase'}], + key: [{ pem: passKey.toString(), passphrase: 'passphrase' }], cert: cert, rejectUnauthorized: false }, common.mustCall()); tls.connect({ port: this.address().port, - key: [{pem: rawKey, passphrase: 'ignored'}], + key: [{ pem: rawKey, passphrase: 'ignored' }], cert: cert, rejectUnauthorized: false }, common.mustCall()); tls.connect({ port: this.address().port, - key: [{pem: rawKey.toString(), passphrase: 'ignored'}], + key: [{ pem: rawKey.toString(), passphrase: 'ignored' }], cert: cert, rejectUnauthorized: false }, common.mustCall()); tls.connect({ port: this.address().port, - key: [{pem: rawKey}], + key: [{ pem: rawKey }], passphrase: 'ignored', cert: cert, rejectUnauthorized: false @@ -201,7 +201,7 @@ server.listen(0, common.mustCall(function() { tls.connect({ port: this.address().port, - key: [{pem: rawKey.toString()}], + key: [{ pem: rawKey.toString() }], passphrase: 'ignored', cert: cert, rejectUnauthorized: false @@ -209,14 +209,14 @@ server.listen(0, common.mustCall(function() { tls.connect({ port: this.address().port, - key: [{pem: rawKey}], + key: [{ pem: rawKey }], cert: cert, rejectUnauthorized: false }, common.mustCall()); tls.connect({ port: this.address().port, - key: [{pem: rawKey.toString()}], + key: [{ pem: rawKey.toString() }], cert: cert, rejectUnauthorized: false }, common.mustCall()); @@ -246,7 +246,7 @@ assert.throws(function() { assert.throws(function() { tls.connect({ port: server.address().port, - key: [{pem: passKey}], + key: [{ pem: passKey }], cert: cert, rejectUnauthorized: false }); @@ -278,7 +278,7 @@ assert.throws(function() { assert.throws(function() { tls.connect({ port: server.address().port, - key: [{pem: passKey}], + key: [{ pem: passKey }], passphrase: 'invalid', cert: cert, rejectUnauthorized: false @@ -288,7 +288,7 @@ assert.throws(function() { assert.throws(function() { tls.connect({ port: server.address().port, - key: [{pem: passKey, passphrase: 'invalid'}], + key: [{ pem: passKey, passphrase: 'invalid' }], passphrase: 'passphrase', // Valid but unused cert: cert, rejectUnauthorized: false diff --git a/test/parallel/test-tls-peer-certificate.js b/test/parallel/test-tls-peer-certificate.js index ba18870d82..1dfe6d4427 100644 --- a/test/parallel/test-tls-peer-certificate.js +++ b/test/parallel/test-tls-peer-certificate.js @@ -30,7 +30,7 @@ const { } = require(join(common.fixturesDir, 'tls-connect')); connect({ - client: {rejectUnauthorized: false}, + client: { rejectUnauthorized: false }, server: keys.agent1, }, function(err, pair, cleanup) { assert.ifError(err); diff --git a/test/parallel/test-tls-securepair-server.js b/test/parallel/test-tls-securepair-server.js index 6aebc80722..3e61f86605 100644 --- a/test/parallel/test-tls-securepair-server.js +++ b/test/parallel/test-tls-securepair-server.js @@ -43,7 +43,7 @@ function log(a) { const server = net.createServer(common.mustCall(function(socket) { log(`connection fd=${socket.fd}`); - const sslcontext = tls.createSecureContext({key: key, cert: cert}); + const sslcontext = tls.createSecureContext({ key: key, cert: cert }); sslcontext.context.setCiphers('RC4-SHA:AES128-SHA:AES256-SHA'); const pair = tls.createSecurePair(sslcontext, true); diff --git a/test/parallel/test-tls-socket-default-options.js b/test/parallel/test-tls-socket-default-options.js index edf16a6bff..eb3758e6ce 100644 --- a/test/parallel/test-tls-socket-default-options.js +++ b/test/parallel/test-tls-socket-default-options.js @@ -17,19 +17,22 @@ test({}, (err) => { assert.strictEqual(err.message, 'unable to verify the first certificate'); }); -test({secureContext: tls.createSecureContext({ca: keys.agent1.ca})}, (err) => { - assert.ifError(err); -}); +test( + { secureContext: tls.createSecureContext({ ca: keys.agent1.ca }) }, + (err) => { assert.ifError(err); }); -test({ca: keys.agent1.ca}, (err) => { - assert.ifError(err); -}); +test( + { ca: keys.agent1.ca }, + (err) => { assert.ifError(err); }); // Secure context options, like ca, are ignored if a sec ctx is explicitly // provided. -test({secureContext: tls.createSecureContext(), ca: keys.agent1.ca}, (err) => { - assert.strictEqual(err.message, 'unable to verify the first certificate'); -}); +test( + { secureContext: tls.createSecureContext(), ca: keys.agent1.ca }, + (err) => { + assert.strictEqual(err.message, + 'unable to verify the first certificate'); + }); function test(client, callback) { callback = common.mustCall(callback); diff --git a/test/parallel/test-tls-socket-failed-handshake-emits-error.js b/test/parallel/test-tls-socket-failed-handshake-emits-error.js index 16175b8898..a54b7170f0 100644 --- a/test/parallel/test-tls-socket-failed-handshake-emits-error.js +++ b/test/parallel/test-tls-socket-failed-handshake-emits-error.js @@ -31,7 +31,7 @@ const server = net.createServer(function(c) { }); }, common.platformTimeout(200)); }).listen(0, function() { - const c = net.connect({port: this.address().port}, function() { + const c = net.connect({ port: this.address().port }, function() { c.write(bonkers); }); }); diff --git a/test/parallel/test-url-format-whatwg.js b/test/parallel/test-url-format-whatwg.js index d6afe46426..9174c5a274 100644 --- a/test/parallel/test-url-format-whatwg.js +++ b/test/parallel/test-url-format-whatwg.js @@ -36,76 +36,76 @@ assert.strictEqual( // Any truthy value will be treated as true. assert.strictEqual( - url.format(myURL, {fragment: false}), + url.format(myURL, { fragment: false }), 'http://xn--lck1c3crb1723bpq4a.com/a?a=b' ); assert.strictEqual( - url.format(myURL, {fragment: ''}), + url.format(myURL, { fragment: '' }), 'http://xn--lck1c3crb1723bpq4a.com/a?a=b' ); assert.strictEqual( - url.format(myURL, {fragment: 0}), + url.format(myURL, { fragment: 0 }), 'http://xn--lck1c3crb1723bpq4a.com/a?a=b' ); assert.strictEqual( - url.format(myURL, {fragment: 1}), + url.format(myURL, { fragment: 1 }), 'http://xn--lck1c3crb1723bpq4a.com/a?a=b#c' ); assert.strictEqual( - url.format(myURL, {fragment: {}}), + url.format(myURL, { fragment: {} }), 'http://xn--lck1c3crb1723bpq4a.com/a?a=b#c' ); assert.strictEqual( - url.format(myURL, {search: false}), + url.format(myURL, { search: false }), 'http://xn--lck1c3crb1723bpq4a.com/a#c' ); assert.strictEqual( - url.format(myURL, {search: ''}), + url.format(myURL, { search: '' }), 'http://xn--lck1c3crb1723bpq4a.com/a#c' ); assert.strictEqual( - url.format(myURL, {search: 0}), + url.format(myURL, { search: 0 }), 'http://xn--lck1c3crb1723bpq4a.com/a#c' ); assert.strictEqual( - url.format(myURL, {search: 1}), + url.format(myURL, { search: 1 }), 'http://xn--lck1c3crb1723bpq4a.com/a?a=b#c' ); assert.strictEqual( - url.format(myURL, {search: {}}), + url.format(myURL, { search: {} }), 'http://xn--lck1c3crb1723bpq4a.com/a?a=b#c' ); assert.strictEqual( - url.format(myURL, {unicode: true}), + url.format(myURL, { unicode: true }), 'http://理容ナカムラ.com/a?a=b#c' ); assert.strictEqual( - url.format(myURL, {unicode: 1}), + url.format(myURL, { unicode: 1 }), 'http://理容ナカムラ.com/a?a=b#c' ); assert.strictEqual( - url.format(myURL, {unicode: {}}), + url.format(myURL, { unicode: {} }), 'http://理容ナカムラ.com/a?a=b#c' ); assert.strictEqual( - url.format(myURL, {unicode: false}), + url.format(myURL, { unicode: false }), 'http://xn--lck1c3crb1723bpq4a.com/a?a=b#c' ); assert.strictEqual( - url.format(myURL, {unicode: 0}), + url.format(myURL, { unicode: 0 }), 'http://xn--lck1c3crb1723bpq4a.com/a?a=b#c' ); diff --git a/test/parallel/test-url-parse-query.js b/test/parallel/test-url-parse-query.js index 67682d0aad..f9174d599a 100644 --- a/test/parallel/test-url-parse-query.js +++ b/test/parallel/test-url-parse-query.js @@ -25,7 +25,7 @@ const parseTestsWithQueryString = { href: '/foo/bar?baz=quux#frag', hash: '#frag', search: '?baz=quux', - query: createWithNoPrototype([{key: 'baz', value: 'quux'}]), + query: createWithNoPrototype([{ key: 'baz', value: 'quux' }]), pathname: '/foo/bar', path: '/foo/bar?baz=quux' }, diff --git a/test/parallel/test-util-format.js b/test/parallel/test-util-format.js index 4527bf40e4..867cd57b62 100644 --- a/test/parallel/test-util-format.js +++ b/test/parallel/test-util-format.js @@ -30,7 +30,7 @@ assert.strictEqual(util.format(''), ''); assert.strictEqual(util.format([]), '[]'); assert.strictEqual(util.format([0]), '[ 0 ]'); assert.strictEqual(util.format({}), '{}'); -assert.strictEqual(util.format({foo: 42}), '{ foo: 42 }'); +assert.strictEqual(util.format({ foo: 42 }), '{ foo: 42 }'); assert.strictEqual(util.format(null), 'null'); assert.strictEqual(util.format(true), 'true'); assert.strictEqual(util.format(false), 'false'); diff --git a/test/parallel/test-util-inspect-proxy.js b/test/parallel/test-util-inspect-proxy.js index ae6da3a34f..ed9e9d196a 100644 --- a/test/parallel/test-util-inspect-proxy.js +++ b/test/parallel/test-util-inspect-proxy.js @@ -4,7 +4,7 @@ require('../common'); const assert = require('assert'); const util = require('util'); const processUtil = process.binding('util'); -const opts = {showProxy: true}; +const opts = { showProxy: true }; const target = {}; const handler = { diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index 3b3b93dc00..3bba320b36 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -51,31 +51,32 @@ assert.strictEqual(util.inspect([1, 2]), '[ 1, 2 ]'); assert.strictEqual(util.inspect([1, [2, 3]]), '[ 1, [ 2, 3 ] ]'); assert.strictEqual(util.inspect({}), '{}'); -assert.strictEqual(util.inspect({a: 1}), '{ a: 1 }'); -assert.strictEqual(util.inspect({a: function() {}}), '{ a: [Function: a] }'); -assert.strictEqual(util.inspect({a: () => {}}), '{ a: [Function: a] }'); -assert.strictEqual(util.inspect({a: async function() {}}), +assert.strictEqual(util.inspect({ a: 1 }), '{ a: 1 }'); +assert.strictEqual(util.inspect({ a: function() {} }), '{ a: [Function: a] }'); +assert.strictEqual(util.inspect({ a: () => {} }), '{ a: [Function: a] }'); +assert.strictEqual(util.inspect({ a: async function() {} }), '{ a: [AsyncFunction: a] }'); -assert.strictEqual(util.inspect({a: async () => {}}), +assert.strictEqual(util.inspect({ a: async () => {} }), '{ a: [AsyncFunction: a] }'); -assert.strictEqual(util.inspect({a: function*() {}}), +assert.strictEqual(util.inspect({ a: function*() {} }), '{ a: [GeneratorFunction: a] }'); -assert.strictEqual(util.inspect({a: 1, b: 2}), '{ a: 1, b: 2 }'); -assert.strictEqual(util.inspect({'a': {}}), '{ a: {} }'); -assert.strictEqual(util.inspect({'a': {'b': 2}}), '{ a: { b: 2 } }'); -assert.strictEqual(util.inspect({'a': {'b': { 'c': { 'd': 2 }}}}), +assert.strictEqual(util.inspect({ a: 1, b: 2 }), '{ a: 1, b: 2 }'); +assert.strictEqual(util.inspect({ 'a': {} }), '{ a: {} }'); +assert.strictEqual(util.inspect({ 'a': { 'b': 2 } }), '{ a: { b: 2 } }'); +assert.strictEqual(util.inspect({ 'a': { 'b': { 'c': { 'd': 2 } } } }), '{ a: { b: { c: [Object] } } }'); -assert.strictEqual(util.inspect({'a': {'b': { 'c': { 'd': 2 }}}}, false, null), - '{ a: { b: { c: { d: 2 } } } }'); +assert.strictEqual( + util.inspect({ 'a': { 'b': { 'c': { 'd': 2 } } } }, false, null), + '{ a: { b: { c: { d: 2 } } } }'); assert.strictEqual(util.inspect([1, 2, 3], true), '[ 1, 2, 3, [length]: 3 ]'); -assert.strictEqual(util.inspect({'a': {'b': { 'c': 2}}}, false, 0), +assert.strictEqual(util.inspect({ 'a': { 'b': { 'c': 2 } } }, false, 0), '{ a: [Object] }'); -assert.strictEqual(util.inspect({'a': {'b': { 'c': 2}}}, false, 1), +assert.strictEqual(util.inspect({ 'a': { 'b': { 'c': 2 } } }, false, 1), '{ a: { b: [Object] } }'); -assert.strictEqual(util.inspect({'a': {'b': ['c']}}, false, 1), +assert.strictEqual(util.inspect({ 'a': { 'b': ['c'] } }, false, 1), '{ a: { b: [Array] } }'); assert.strictEqual(util.inspect(Object.create({}, - {visible: {value: 1, enumerable: true}, hidden: {value: 2}})), + { visible: { value: 1, enumerable: true }, hidden: { value: 2 } })), '{ visible: 1 }' ); assert.strictEqual(util.inspect(Object.assign(new String('hello'), @@ -88,14 +89,14 @@ assert.strictEqual(util.inspect(process.stdin._handle._externalStream), { const regexp = /regexp/; regexp.aprop = 42; - assert.strictEqual(util.inspect({a: regexp}, false, 0), '{ a: /regexp/ }'); + assert.strictEqual(util.inspect({ a: regexp }, false, 0), '{ a: /regexp/ }'); } assert(/Object/.test( - util.inspect({a: {a: {a: {a: {}}}}}, undefined, undefined, true) + util.inspect({ a: { a: { a: { a: {} } } } }, undefined, undefined, true) )); assert(!/Object/.test( - util.inspect({a: {a: {a: {a: {}}}}}, undefined, null, true) + util.inspect({ a: { a: { a: { a: {} } } } }, undefined, null, true) )); for (const showHidden of [true, false]) { @@ -235,8 +236,10 @@ for (const showHidden of [true, false]) { // 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 }') { assert.fail(`unexpected value for out ${out}`); @@ -245,10 +248,10 @@ for (const showHidden of [true, false]) { // Objects without prototype { - const out = util.inspect(Object.create(null, - { name: {value: 'Tim', - enumerable: true}, - hidden: {value: 'secret'}}), true); + const out = util.inspect(Object.create(null, { + name: { value: 'Tim', enumerable: true }, + hidden: { value: 'secret' } + }), true); if (out !== "{ [hidden]: 'secret', name: 'Tim' }" && out !== "{ name: 'Tim', [hidden]: 'secret' }") { assert.fail(`unexpected value for out ${out}`); @@ -256,23 +259,27 @@ for (const showHidden of [true, false]) { } assert.strictEqual( - util.inspect(Object.create(null, - {name: {value: 'Tim', enumerable: true}, - hidden: {value: 'secret'}})), + util.inspect(Object.create(null, { + name: { value: 'Tim', enumerable: true }, + hidden: { value: 'secret' } + })), '{ name: \'Tim\' }' ); // Dynamic properties { - assert.strictEqual(util.inspect({get readonly() {}}), - '{ readonly: [Getter] }'); + assert.strictEqual( + util.inspect({ get readonly() {} }), + '{ readonly: [Getter] }'); - assert.strictEqual(util.inspect({get readwrite() {}, set readwrite(val) {}}), - '{ readwrite: [Getter/Setter] }'); + assert.strictEqual( + util.inspect({ get readwrite() {}, set readwrite(val) {} }), + '{ readwrite: [Getter/Setter] }'); - assert.strictEqual(util.inspect({set writeonly(val) {}}), - '{ writeonly: [Setter] }'); + assert.strictEqual( + util.inspect({ set writeonly(val) {} }), + '{ writeonly: [Setter] }'); const value = {}; value['a'] = value; @@ -672,7 +679,7 @@ assert.doesNotThrow(() => { function testLines(input) { const countLines = (str) => (str.match(/\n/g) || []).length; const withoutColor = util.inspect(input); - const withColor = util.inspect(input, {colors: true}); + const withColor = util.inspect(input, { colors: true }); assert.strictEqual(countLines(withoutColor), countLines(withColor)); } @@ -680,11 +687,11 @@ assert.doesNotThrow(() => { testLines([1, 2, 3, 4, 5, 6, 7]); testLines(bigArray); - testLines({foo: 'bar', baz: 35, b: {a: 35}}); + testLines({ foo: 'bar', baz: 35, b: { a: 35 } }); testLines({ foo: 'bar', baz: 35, - b: {a: 35}, + b: { a: 35 }, veryLongKey: 'very long value', evenLongerKey: ['with even longer value in array'] }); @@ -740,7 +747,7 @@ if (typeof Symbol !== 'undefined') { Object.defineProperty( subject, Symbol(), - {enumerable: false, value: 'non-enum'}); + { enumerable: false, value: 'non-enum' }); assert.strictEqual(util.inspect(subject), '{ [Symbol(symbol)]: 42 }'); assert.strictEqual( util.inspect(subject, options), @@ -982,22 +989,23 @@ if (typeof Symbol !== 'undefined') { } { - const obj = {foo: 'abc', bar: 'xyz'}; - const oneLine = util.inspect(obj, {breakLength: Infinity}); + const obj = { foo: 'abc', bar: 'xyz' }; + const oneLine = util.inspect(obj, { breakLength: Infinity }); // Subtract four for the object's two curly braces and two spaces of padding. // Add one more to satisfy the strictly greater than condition in the code. const breakpoint = oneLine.length - 5; - const twoLines = util.inspect(obj, {breakLength: breakpoint}); + const twoLines = util.inspect(obj, { breakLength: breakpoint }); assert.strictEqual(oneLine, '{ foo: \'abc\', bar: \'xyz\' }'); - assert.strictEqual(oneLine, util.inspect(obj, {breakLength: breakpoint + 1})); + assert.strictEqual(oneLine, + util.inspect(obj, { breakLength: breakpoint + 1 })); assert.strictEqual(twoLines, '{ foo: \'abc\',\n bar: \'xyz\' }'); } // util.inspect.defaultOptions tests { const arr = new Array(101).fill(); - const obj = {a: {a: {a: {a: 1}}}}; + const obj = { a: { a: { a: { a: 1 } } } }; const oldOptions = Object.assign({}, util.inspect.defaultOptions); @@ -1016,7 +1024,7 @@ if (typeof Symbol !== 'undefined') { ); // Set multiple options through object assignment - util.inspect.defaultOptions = {maxArrayLength: null, depth: null}; + util.inspect.defaultOptions = { maxArrayLength: null, depth: null }; assert(!/1 more item/.test(util.inspect(arr))); assert(!/Object/.test(util.inspect(obj))); util.inspect.defaultOptions = oldOptions; diff --git a/test/parallel/test-util-log.js b/test/parallel/test-util-log.js index d660106e17..907a361e97 100644 --- a/test/parallel/test-util-log.js +++ b/test/parallel/test-util-log.js @@ -34,15 +34,15 @@ common.hijackStdout(function(data) { common.hijackStderr(common.mustNotCall('stderr.write must not be called')); const tests = [ - {input: 'foo', output: 'foo'}, - {input: undefined, output: 'undefined'}, - {input: null, output: 'null'}, - {input: false, output: 'false'}, - {input: 42, output: '42'}, - {input: function() {}, output: '[Function: input]'}, - {input: parseInt('not a number', 10), output: 'NaN'}, - {input: {answer: 42}, output: '{ answer: 42 }'}, - {input: [1, 2, 3], output: '[ 1, 2, 3 ]'} + { input: 'foo', output: 'foo' }, + { input: undefined, output: 'undefined' }, + { input: null, output: 'null' }, + { input: false, output: 'false' }, + { input: 42, output: '42' }, + { input: function() {}, output: '[Function: input]' }, + { input: parseInt('not a number', 10), output: 'NaN' }, + { input: { answer: 42 }, output: '{ answer: 42 }' }, + { input: [1, 2, 3], output: '[ 1, 2, 3 ]' } ]; // test util.log() diff --git a/test/parallel/test-util-promisify.js b/test/parallel/test-util-promisify.js index 8491971415..08a21b3d2c 100644 --- a/test/parallel/test-util-promisify.js +++ b/test/parallel/test-util-promisify.js @@ -55,7 +55,7 @@ const stat = promisify(fs.stat); fn[customPromisifyArgs] = ['first', 'second']; promisify(fn)().then(common.mustCall((obj) => { - assert.deepStrictEqual(obj, {first: firstValue, second: secondValue}); + assert.deepStrictEqual(obj, { first: firstValue, second: secondValue }); })); } diff --git a/test/parallel/test-util.js b/test/parallel/test-util.js index 191f4361b4..3b2729c107 100644 --- a/test/parallel/test-util.js +++ b/test/parallel/test-util.js @@ -100,13 +100,13 @@ assert.strictEqual(false, util.isBuffer('foo')); assert.strictEqual(true, util.isBuffer(Buffer.from('foo'))); // _extend -assert.deepStrictEqual(util._extend({a: 1}), {a: 1}); -assert.deepStrictEqual(util._extend({a: 1}, []), {a: 1}); -assert.deepStrictEqual(util._extend({a: 1}, null), {a: 1}); -assert.deepStrictEqual(util._extend({a: 1}, true), {a: 1}); -assert.deepStrictEqual(util._extend({a: 1}, false), {a: 1}); -assert.deepStrictEqual(util._extend({a: 1}, {b: 2}), {a: 1, b: 2}); -assert.deepStrictEqual(util._extend({a: 1, b: 2}, {b: 3}), {a: 1, b: 3}); +assert.deepStrictEqual(util._extend({ a: 1 }), { a: 1 }); +assert.deepStrictEqual(util._extend({ a: 1 }, []), { a: 1 }); +assert.deepStrictEqual(util._extend({ a: 1 }, null), { a: 1 }); +assert.deepStrictEqual(util._extend({ a: 1 }, true), { a: 1 }); +assert.deepStrictEqual(util._extend({ a: 1 }, false), { a: 1 }); +assert.deepStrictEqual(util._extend({ a: 1 }, { b: 2 }), { a: 1, b: 2 }); +assert.deepStrictEqual(util._extend({ a: 1, b: 2 }, { b: 3 }), { a: 1, b: 3 }); // deprecated assert.strictEqual(util.isBoolean(true), true); diff --git a/test/parallel/test-vm-context.js b/test/parallel/test-vm-context.js index 1cf2d5f90a..8d47cb52ab 100644 --- a/test/parallel/test-vm-context.js +++ b/test/parallel/test-vm-context.js @@ -33,7 +33,7 @@ let result = script.runInContext(context); assert.strictEqual('passed', result); console.error('create a new pre-populated context'); -context = vm.createContext({'foo': 'bar', 'thing': 'lala'}); +context = vm.createContext({ 'foo': 'bar', 'thing': 'lala' }); assert.strictEqual('bar', context.foo); assert.strictEqual('lala', context.thing); diff --git a/test/parallel/test-vm-create-and-run-in-context.js b/test/parallel/test-vm-create-and-run-in-context.js index 96d7631f24..1adf85460d 100644 --- a/test/parallel/test-vm-create-and-run-in-context.js +++ b/test/parallel/test-vm-create-and-run-in-context.js @@ -32,7 +32,7 @@ let result = vm.runInContext('"passed";', context); assert.strictEqual('passed', result); console.error('create a new pre-populated context'); -context = vm.createContext({'foo': 'bar', 'thing': 'lala'}); +context = vm.createContext({ 'foo': 'bar', 'thing': 'lala' }); assert.strictEqual('bar', context.foo); assert.strictEqual('lala', context.thing); @@ -43,7 +43,7 @@ assert.strictEqual('lala', context.thing); // https://github.com/nodejs/node/issues/5768 console.error('run in contextified sandbox without referencing the context'); -const sandbox = {x: 1}; +const sandbox = { x: 1 }; vm.createContext(sandbox); global.gc(); vm.runInContext('x = 2', sandbox); diff --git a/test/parallel/test-vm-property-not-on-sandbox.js b/test/parallel/test-vm-property-not-on-sandbox.js index 08ea589078..9f652f5dcf 100644 --- a/test/parallel/test-vm-property-not-on-sandbox.js +++ b/test/parallel/test-vm-property-not-on-sandbox.js @@ -23,8 +23,8 @@ const vm = require('vm'); // // This test case is partially inspired by // https://github.com/nodejs/node/issues/855 -const sandbox = {console}; -sandbox.document = {defaultView: sandbox}; +const sandbox = { console }; +sandbox.document = { defaultView: sandbox }; vm.createContext(sandbox); const code = `Object.defineProperty( this, diff --git a/test/parallel/test-whatwg-url-searchparams-inspect.js b/test/parallel/test-whatwg-url-searchparams-inspect.js index 9a56543637..163fa185ed 100644 --- a/test/parallel/test-whatwg-url-searchparams-inspect.js +++ b/test/parallel/test-whatwg-url-searchparams-inspect.js @@ -13,7 +13,7 @@ assert.strictEqual(util.inspect(sp.keys()), "URLSearchParamsIterator { 'a', 'b', 'b' }"); assert.strictEqual(util.inspect(sp.values()), "URLSearchParamsIterator { 'a', 'b', 'c' }"); -assert.strictEqual(util.inspect(sp.keys(), {breakLength: 1}), +assert.strictEqual(util.inspect(sp.keys(), { breakLength: 1 }), "URLSearchParamsIterator {\n 'a',\n 'b',\n 'b' }"); const iterator = sp.entries(); diff --git a/test/parallel/test-whatwg-url-searchparams-sort.js b/test/parallel/test-whatwg-url-searchparams-sort.js index 712dbc5636..406dceca2b 100644 --- a/test/parallel/test-whatwg-url-searchparams-sort.js +++ b/test/parallel/test-whatwg-url-searchparams-sort.js @@ -58,7 +58,7 @@ const { test, assert_array_equals } = require('../common/wpt'); // Tests below are not from WPT. // Test bottom-up iterative stable merge sort -const tests = [{input: '', output: []}]; +const tests = [{ input: '', output: [] }]; const pairs = []; for (let i = 10; i < 100; i++) { pairs.push([`a${i}`, 'b']); diff --git a/test/parallel/test-zerolengthbufferbug.js b/test/parallel/test-zerolengthbufferbug.js index 913e71fa8d..75aaa2f48d 100644 --- a/test/parallel/test-zerolengthbufferbug.js +++ b/test/parallel/test-zerolengthbufferbug.js @@ -7,8 +7,8 @@ const http = require('http'); const server = http.createServer(function(req, res) { const buffer = Buffer.alloc(0); // FIXME: WTF gjslint want this? - res.writeHead(200, {'Content-Type': 'text/html', - 'Content-Length': buffer.length}); + res.writeHead(200, { 'Content-Type': 'text/html', + 'Content-Length': buffer.length }); res.end(buffer); }); diff --git a/test/parallel/test-zlib-const.js b/test/parallel/test-zlib-const.js index ba6bb5fb8a..e4c673aff0 100644 --- a/test/parallel/test-zlib-const.js +++ b/test/parallel/test-zlib-const.js @@ -11,7 +11,7 @@ assert.strictEqual(zlib.constants.Z_OK, 0, 'Z_OK should be 0'); assert.strictEqual(zlib.codes.Z_OK, 0, 'Z_OK should be 0'); zlib.codes.Z_OK = 1; assert.strictEqual(zlib.codes.Z_OK, 0, 'zlib.codes.Z_OK should be 0'); -zlib.codes = {Z_OK: 1}; +zlib.codes = { Z_OK: 1 }; assert.strictEqual(zlib.codes.Z_OK, 0, 'zlib.codes.Z_OK should be 0'); assert.ok(Object.isFrozen(zlib.codes), 'zlib.codes should be frozen'); diff --git a/test/parallel/test-zlib-deflate-constructors.js b/test/parallel/test-zlib-deflate-constructors.js index 01930b2720..e4b39002fb 100644 --- a/test/parallel/test-zlib-deflate-constructors.js +++ b/test/parallel/test-zlib-deflate-constructors.js @@ -14,7 +14,7 @@ assert.ok(new zlib.DeflateRaw() instanceof zlib.DeflateRaw); // Throws if `opts.chunkSize` is invalid assert.throws( - () => { new zlib.Deflate({chunkSize: -Infinity}); }, + () => { new zlib.Deflate({ chunkSize: -Infinity }); }, /^RangeError: Invalid chunk size: -Infinity$/ ); @@ -23,23 +23,23 @@ assert.strictEqual(zlib.constants.Z_MAX_CHUNK, Infinity); // Throws if `opts.windowBits` is invalid assert.throws( - () => { new zlib.Deflate({windowBits: -Infinity}); }, + () => { new zlib.Deflate({ windowBits: -Infinity }); }, /^RangeError: Invalid windowBits: -Infinity$/ ); assert.throws( - () => { new zlib.Deflate({windowBits: Infinity}); }, + () => { new zlib.Deflate({ windowBits: Infinity }); }, /^RangeError: Invalid windowBits: Infinity$/ ); // Throws if `opts.level` is invalid assert.throws( - () => { new zlib.Deflate({level: -Infinity}); }, + () => { new zlib.Deflate({ level: -Infinity }); }, /^RangeError: Invalid compression level: -Infinity$/ ); assert.throws( - () => { new zlib.Deflate({level: Infinity}); }, + () => { new zlib.Deflate({ level: Infinity }); }, /^RangeError: Invalid compression level: Infinity$/ ); @@ -56,34 +56,34 @@ assert.throws( // Throws if `opts.memLevel` is invalid assert.throws( - () => { new zlib.Deflate({memLevel: -Infinity}); }, + () => { new zlib.Deflate({ memLevel: -Infinity }); }, /^RangeError: Invalid memLevel: -Infinity$/ ); assert.throws( - () => { new zlib.Deflate({memLevel: Infinity}); }, + () => { new zlib.Deflate({ memLevel: Infinity }); }, /^RangeError: Invalid memLevel: Infinity$/ ); // Does not throw if opts.strategy is valid assert.doesNotThrow( - () => { new zlib.Deflate({strategy: zlib.constants.Z_FILTERED}); } + () => { new zlib.Deflate({ strategy: zlib.constants.Z_FILTERED }); } ); assert.doesNotThrow( - () => { new zlib.Deflate({strategy: zlib.constants.Z_HUFFMAN_ONLY}); } + () => { new zlib.Deflate({ strategy: zlib.constants.Z_HUFFMAN_ONLY }); } ); assert.doesNotThrow( - () => { new zlib.Deflate({strategy: zlib.constants.Z_RLE}); } + () => { new zlib.Deflate({ strategy: zlib.constants.Z_RLE }); } ); assert.doesNotThrow( - () => { new zlib.Deflate({strategy: zlib.constants.Z_FIXED}); } + () => { new zlib.Deflate({ strategy: zlib.constants.Z_FIXED }); } ); assert.doesNotThrow( - () => { new zlib.Deflate({ strategy: zlib.constants.Z_DEFAULT_STRATEGY}); } + () => { new zlib.Deflate({ strategy: zlib.constants.Z_DEFAULT_STRATEGY }); } ); // Throws if opt.strategy is the wrong type. @@ -94,7 +94,7 @@ assert.throws( // Throws if opts.strategy is invalid assert.throws( - () => { new zlib.Deflate({strategy: 'this is a bogus strategy'}); }, + () => { new zlib.Deflate({ strategy: 'this is a bogus strategy' }); }, /^TypeError: Invalid strategy: this is a bogus strategy$/ ); @@ -106,6 +106,6 @@ assert.throws( // Throws if opts.dictionary is not a Buffer assert.throws( - () => { new zlib.Deflate({dictionary: 'not a buffer'}); }, + () => { new zlib.Deflate({ dictionary: 'not a buffer' }); }, /^TypeError: Invalid dictionary: it should be a Buffer, TypedArray, or DataView$/ ); diff --git a/test/parallel/test-zlib-invalid-input.js b/test/parallel/test-zlib-invalid-input.js index f6d3a85b95..ac9ce0e137 100644 --- a/test/parallel/test-zlib-invalid-input.js +++ b/test/parallel/test-zlib-invalid-input.js @@ -26,7 +26,7 @@ require('../common'); const assert = require('assert'); const zlib = require('zlib'); -const nonStringInputs = [1, true, {a: 1}, ['a']]; +const nonStringInputs = [1, true, { a: 1 }, ['a']]; console.error('Doing the non-strings'); nonStringInputs.forEach(function(input) { diff --git a/test/parallel/test-zlib-not-string-or-buffer.js b/test/parallel/test-zlib-not-string-or-buffer.js index 9bbee01786..11b55138af 100644 --- a/test/parallel/test-zlib-not-string-or-buffer.js +++ b/test/parallel/test-zlib-not-string-or-buffer.js @@ -16,4 +16,4 @@ assert.throws(() => { zlib.deflateSync(false); }, expected); assert.throws(() => { zlib.deflateSync(0); }, expected); assert.throws(() => { zlib.deflateSync(1); }, expected); assert.throws(() => { zlib.deflateSync([1, 2, 3]); }, expected); -assert.throws(() => { zlib.deflateSync({foo: 'bar'}); }, expected); +assert.throws(() => { zlib.deflateSync({ foo: 'bar' }); }, expected); diff --git a/test/pummel/test-exec.js b/test/pummel/test-exec.js index 29852528ee..e6e88f53e1 100644 --- a/test/pummel/test-exec.js +++ b/test/pummel/test-exec.js @@ -90,7 +90,8 @@ exec(SLEEP3_COMMAND, { timeout: 50 }, function(err, stdout, stderr) { const startSleep3 = new Date(); -const killMeTwice = exec(SLEEP3_COMMAND, {timeout: 1000}, killMeTwiceCallback); +const killMeTwice = exec(SLEEP3_COMMAND, { timeout: 1000 }, + killMeTwiceCallback); process.nextTick(function() { console.log('kill pid %d', killMeTwice.pid); @@ -117,7 +118,7 @@ function killMeTwiceCallback(err, stdout, stderr) { } -exec('python -c "print 200000*\'C\'"', {maxBuffer: 1000}, +exec('python -c "print 200000*\'C\'"', { maxBuffer: 1000 }, function(err, stdout, stderr) { assert.ok(err); assert.ok(/maxBuffer/.test(err.message)); diff --git a/test/pummel/test-fs-watch-file-slow.js b/test/pummel/test-fs-watch-file-slow.js index acccec8a82..9ae9922ec8 100644 --- a/test/pummel/test-fs-watch-file-slow.js +++ b/test/pummel/test-fs-watch-file-slow.js @@ -36,7 +36,7 @@ try { // swallow } -fs.watchFile(FILENAME, {interval: TIMEOUT - 250}, function(curr, prev) { +fs.watchFile(FILENAME, { interval: TIMEOUT - 250 }, function(curr, prev) { console.log([curr, prev]); switch (++nevents) { case 1: diff --git a/test/pummel/test-http-client-reconnect-bug.js b/test/pummel/test-http-client-reconnect-bug.js index 656943ec86..d3e540166c 100644 --- a/test/pummel/test-http-client-reconnect-bug.js +++ b/test/pummel/test-http-client-reconnect-bug.js @@ -34,7 +34,7 @@ server.on('listening', common.mustCall(function() { client.on('error', common.mustCall()); client.on('end', common.mustCall()); - const request = client.request('GET', '/', {'host': 'localhost'}); + const request = client.request('GET', '/', { 'host': 'localhost' }); request.end(); request.on('response', function(response) { console.log(`STATUS: ${response.statusCode}`); diff --git a/test/pummel/test-keep-alive.js b/test/pummel/test-keep-alive.js index d2387495c1..479ec12948 100644 --- a/test/pummel/test-keep-alive.js +++ b/test/pummel/test-keep-alive.js @@ -58,7 +58,7 @@ function runAb(opts, callback) { } args.push(url.format({ hostname: '127.0.0.1', - port: common.PORT, protocol: 'http'})); + port: common.PORT, protocol: 'http' })); const child = spawn('wrk', args); child.stderr.pipe(process.stderr); diff --git a/test/pummel/test-regress-GH-892.js b/test/pummel/test-regress-GH-892.js index b1d46adbab..76f98b2957 100644 --- a/test/pummel/test-regress-GH-892.js +++ b/test/pummel/test-regress-GH-892.js @@ -97,7 +97,7 @@ const server = https.Server(serverOptions, function(req, res) { req.on('end', function() { assert.strictEqual(bytesExpected, uploadCount); - res.writeHead(200, {'content-type': 'text/plain'}); + res.writeHead(200, { 'content-type': 'text/plain' }); res.end('successful upload\n'); }); }); diff --git a/test/pummel/test-tls-securepair-client.js b/test/pummel/test-tls-securepair-client.js index e9bae682d7..e1a489a145 100644 --- a/test/pummel/test-tls-securepair-client.js +++ b/test/pummel/test-tls-securepair-client.js @@ -121,7 +121,7 @@ function test(keyfn, certfn, check, next) { function startClient() { const s = new net.Stream(); - const sslcontext = tls.createSecureContext({key: key, cert: cert}); + const sslcontext = tls.createSecureContext({ key: key, cert: cert }); sslcontext.context.setCiphers('RC4-SHA:AES128-SHA:AES256-SHA'); const pair = tls.createSecurePair(sslcontext, false); diff --git a/test/sequential/test-benchmark-child-process.js b/test/sequential/test-benchmark-child-process.js index 2314c89948..168f99445d 100644 --- a/test/sequential/test-benchmark-child-process.js +++ b/test/sequential/test-benchmark-child-process.js @@ -14,7 +14,7 @@ const child = fork(runjs, ['--set', 'dur=0', '--set', 'params=1', '--set', 'methodName=execSync', 'child_process'], - {env: {NODEJS_BENCHMARK_ZERO_ALLOWED: 1}}); + { env: { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 } }); child.on('exit', (code, signal) => { assert.strictEqual(code, 0); assert.strictEqual(signal, null); diff --git a/test/sequential/test-benchmark-http.js b/test/sequential/test-benchmark-http.js index fb0c1390c5..b8d47fb898 100644 --- a/test/sequential/test-benchmark-http.js +++ b/test/sequential/test-benchmark-http.js @@ -32,7 +32,7 @@ const child = fork(runjs, ['--set', 'benchmarker=test-double', '--set', 'n=1', '--set', 'res=normal', 'http'], - {env}); + { env }); child.on('exit', (code, signal) => { assert.strictEqual(code, 0); assert.strictEqual(signal, null); diff --git a/test/sequential/test-benchmark-net.js b/test/sequential/test-benchmark-net.js index ef5f4fbb91..43f712701d 100644 --- a/test/sequential/test-benchmark-net.js +++ b/test/sequential/test-benchmark-net.js @@ -20,7 +20,7 @@ const child = fork(runjs, '--set', 'len=1024', '--set', 'type=buf', 'net'], - {env: {NODEJS_BENCHMARK_ZERO_ALLOWED: 1}}); + { env: { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 } }); child.on('exit', (code, signal) => { assert.strictEqual(code, 0); assert.strictEqual(signal, null); diff --git a/test/sequential/test-child-process-execsync.js b/test/sequential/test-child-process-execsync.js index 4fb2915010..63046517a9 100644 --- a/test/sequential/test-child-process-execsync.js +++ b/test/sequential/test-child-process-execsync.js @@ -34,12 +34,12 @@ let caught = false; // Verify that stderr is not accessed when a bad shell is used assert.throws( - function() { execSync('exit -1', {shell: 'bad_shell'}); }, + function() { execSync('exit -1', { shell: 'bad_shell' }); }, /spawnSync bad_shell ENOENT/, 'execSync did not throw the expected exception!' ); assert.throws( - function() { execFileSync('exit -1', {shell: 'bad_shell'}); }, + function() { execFileSync('exit -1', { shell: 'bad_shell' }); }, /spawnSync bad_shell ENOENT/, 'execFileSync did not throw the expected exception!' ); @@ -47,7 +47,7 @@ assert.throws( let cmd, ret; try { cmd = `"${process.execPath}" -e "setTimeout(function(){}, ${SLEEP});"`; - ret = execSync(cmd, {timeout: TIMER}); + ret = execSync(cmd, { timeout: TIMER }); } catch (e) { caught = true; assert.strictEqual(e.errno, 'ETIMEDOUT'); @@ -97,7 +97,7 @@ assert.strictEqual(ret, `${msg}\n`, { const cwd = common.rootDir; const cmd = common.isWindows ? 'echo %cd%' : 'pwd'; - const response = execSync(cmd, {cwd}); + const response = execSync(cmd, { cwd }); assert.strictEqual(response.toString().trim(), cwd); } @@ -105,7 +105,7 @@ assert.strictEqual(ret, `${msg}\n`, // Verify that stderr is not accessed when stdio = 'ignore' - GH #7966 { assert.throws(function() { - execSync('exit -1', {stdio: 'ignore'}); + execSync('exit -1', { stdio: 'ignore' }); }, /Command failed: exit -1/); } diff --git a/test/sequential/test-child-process-fork-getconnections.js b/test/sequential/test-child-process-fork-getconnections.js index f9dda9ba1d..931763cf3c 100644 --- a/test/sequential/test-child-process-fork-getconnections.js +++ b/test/sequential/test-child-process-fork-getconnections.js @@ -31,7 +31,7 @@ if (process.argv[2] === 'child') { process.on('message', function(m, socket) { function sendClosed(id) { - process.send({ id: id, status: 'closed'}); + process.send({ id: id, status: 'closed' }); } if (m.cmd === 'new') { diff --git a/test/sequential/test-fs-watch.js b/test/sequential/test-fs-watch.js index d7750582b0..a2b09b5419 100644 --- a/test/sequential/test-fs-watch.js +++ b/test/sequential/test-fs-watch.js @@ -122,7 +122,7 @@ setImmediate(function() { // https://github.com/joyent/node/issues/2293 - non-persistent watcher should // not block the event loop -fs.watch(__filename, {persistent: false}, function() { +fs.watch(__filename, { persistent: false }, function() { assert(0); }); @@ -138,7 +138,8 @@ assert.throws(function() { oldhandle.close(); // clean up assert.throws(function() { - const w = fs.watchFile(__filename, {persistent: false}, common.mustNotCall()); + const w = fs.watchFile(__filename, { persistent: false }, + common.mustNotCall()); oldhandle = w._handle; w._handle = { stop: w._handle.stop }; w.stop(); diff --git a/test/sequential/test-init.js b/test/sequential/test-init.js index 2e6a23cd34..5ca0de7db3 100644 --- a/test/sequential/test-init.js +++ b/test/sequential/test-init.js @@ -33,7 +33,7 @@ process.env.TEST_INIT = 1; function test(file, expected) { const path = `"${process.execPath}" ${file}`; - child.exec(path, {env: process.env}, common.mustCall((err, out) => { + child.exec(path, { env: process.env }, common.mustCall((err, out) => { assert.ifError(err); assert.strictEqual(out, expected, `'node ${file}' failed!`); })); diff --git a/test/sequential/test-net-listen-shared-ports.js b/test/sequential/test-net-listen-shared-ports.js index 282380ad27..be33821bf6 100644 --- a/test/sequential/test-net-listen-shared-ports.js +++ b/test/sequential/test-net-listen-shared-ports.js @@ -57,7 +57,7 @@ if (cluster.isMaster) { port: common.PORT, exclusive: false }, common.mustCall(function() { - server2.listen({port: common.PORT + 1, exclusive: true}, + server2.listen({ port: common.PORT + 1, exclusive: true }, common.mustCall(function() { // the first worker should succeed process.send('success'); diff --git a/test/sequential/test-stream2-stderr-sync.js b/test/sequential/test-stream2-stderr-sync.js index c5295c0a2f..6eff05513f 100644 --- a/test/sequential/test-stream2-stderr-sync.js +++ b/test/sequential/test-stream2-stderr-sync.js @@ -67,7 +67,7 @@ function child2() { const socket = new net.Socket({ fd: 2, readable: false, - writable: true}); + writable: true }); socket.write('child 2\n'); socket.write('foo\n'); socket.write('bar\n'); diff --git a/tools/doc/json.js b/tools/doc/json.js index aad860f840..455b825275 100644 --- a/tools/doc/json.js +++ b/tools/doc/json.js @@ -39,7 +39,7 @@ marked.setOptions({ }); function doJSON(input, filename, cb) { - const root = {source: filename}; + const root = { source: filename }; const stack = [root]; var depth = 0; var current = root; @@ -329,7 +329,7 @@ function parseSignature(text, sig) { params = params[1]; params = params.split(/,/); var optionalLevel = 0; - const optionalCharDict = {'[': 1, ' ': 0, ']': -1}; + const optionalCharDict = { '[': 1, ' ': 0, ']': -1 }; params.forEach(function(p, i) { p = p.trim(); if (!p) return; diff --git a/tools/eslint-rules/prefer-assert-iferror.js b/tools/eslint-rules/prefer-assert-iferror.js index 0da272d5f6..e152874176 100644 --- a/tools/eslint-rules/prefer-assert-iferror.js +++ b/tools/eslint-rules/prefer-assert-iferror.js @@ -33,7 +33,7 @@ module.exports = { context.report({ node: firstStatement, message: 'Use assert.ifError({{argument}}) instead.', - data: {argument: sourceCode.getText(node.test)} + data: { argument: sourceCode.getText(node.test) } }); } }