diff --git a/benchmark/_test-double-benchmarker.js b/benchmark/_test-double-benchmarker.js index a95ad9c8613db8..0a8c5f9264efc8 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 0cb32689510dd3..8264f53547e8f2 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 1140a81649f9a6..bc53cc727047dc 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 b423c216b1ed73..8c05b15962e424 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 87772222f0a467..fdd4978a1a7a04 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 269fd5a493ee34..407564835598d9 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 09e533de32bf9a..fd04be127bf878 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 56c0e85dad41a4..36bda66a4e857e 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 56f7fb9e7c3a9e..5be5dc9837b867 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 771786d3350513..dc8e020879e400 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 82e25b4c4c8127..55ce76e1db5924 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 805c520e28745c..c220462ce7f163 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 3312bd683ba81b..115a3b64a730f5 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 d1d4b5a7abbf20..6e26a6d0ebeb38 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 f3a7e969287d50..a0c737f46954f1 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 8783047bbbc0a2..b5ff18fcc1911e 100644 --- a/lib/console.js +++ b/lib/console.js @@ -146,7 +146,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), diff --git a/lib/dgram.js b/lib/dgram.js index a19f4d8b5b3ae9..486f269345cacf 100644 --- a/lib/dgram.js +++ b/lib/dgram.js @@ -411,7 +411,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 7a3d3336e3aa1d..6d60c783b3f0fc 100644 --- a/lib/dns.js +++ b/lib/dns.js @@ -169,7 +169,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 17e92f6ee1bba4..ab5af78ccb78e9 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -254,10 +254,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 abde3b38cbca41..adbb0afaa55674 100644 --- a/lib/inspector.js +++ b/lib/inspector.js @@ -66,7 +66,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 5a323035b1e7df..3f83c08354e58f 100644 --- a/lib/internal/bootstrap_node.js +++ b/lib/internal/bootstrap_node.js @@ -476,7 +476,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 62150fe86da1b9..e9eedeb867d545 100644 --- a/lib/internal/child_process.js +++ b/lib/internal/child_process.js @@ -109,7 +109,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 @@ -582,7 +582,7 @@ function setupChannel(target, channel) { throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'options', 'Object'); } - options = Object.assign({swallowErrors: false}, options); + options = Object.assign({ swallowErrors: false }, options); if (this.connected) { return this._send(message, handle, options, callback); @@ -604,7 +604,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 @@ -838,7 +838,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 05663e792b3ba6..4ccf0393223a23 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 15e880ba8c13d4..961289efebc3c9 100644 --- a/lib/internal/socket_list.js +++ b/lib/internal/socket_list.js @@ -102,4 +102,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 091706d4fdb289..113c0c66c0fe47 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 85333d4a6c095f..60d67083274532 100644 --- a/lib/readline.js +++ b/lib/readline.js @@ -683,7 +683,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 }; }; @@ -702,7 +702,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 2a5077f390b54d..0d2be97714d77b 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -1069,7 +1069,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 Error('Bad argument, "action" command must be a function'); } diff --git a/test/addons-napi/test_make_callback_recurse/test.js b/test/addons-napi/test_make_callback_recurse/test.js index 895769bc33029a..77815e052ab1f9 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 9e8f17de28287c..8e44a1b5ed647f 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 895769bc33029a..77815e052ab1f9 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 27536b727d232f..79bbd1751d83fd 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/debugger/helper-debugger-repl.js b/test/debugger/helper-debugger-repl.js index f11d4d94981e0e..365b29e50d6556 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 0baa310a042522..8b05e941749c63 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 569dc574912884..8b50ad5ea4ffce 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/test-port-cluster.js b/test/inspector/test-port-cluster.js index 166f5a8d108664..3b2464d81268b4 100644 --- a/test/inspector/test-port-cluster.js +++ b/test/inspector/test-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/internet/test-dgram-broadcast-multi-process.js b/test/internet/test-dgram-broadcast-multi-process.js index 0ec4bbd9ce5aa7..82ddd7743f64de 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 4d4c7da6a7026d..d3d5ba22009675 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 9b9360c2a1628c..a91b108456c027 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 75e8815f8823d8..e2214433c51436 100644 --- a/test/internet/test-dns.js +++ b/test/internet/test-dns.js @@ -403,22 +403,23 @@ 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 +445,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 +458,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 73ee91d3b2ea0d..8501efd74e619f 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 78c1a7d2eac20e..35e36a014e93e6 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,8 @@ 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 f90cf3568ed9c5..3df9c57219d8be 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 ac73a1475bb449..cb636f2ae2bb80 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 8a40a03a03962a..230c45feab19a7 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 25e94b0f2fd187..d075f91b5954d0 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) { } assert.throws( - () => { assert.deepEqual(new Set([{a: 0}]), new Set([{a: 1}])); }, + () => { assert.deepEqual(new Set([{ a: 0 }]), new Set([{ a: 1 }])); }, common.expectsError({ 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 @@ -339,7 +339,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())); } @@ -357,7 +357,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 98c0f9eef2994f..703097b26051c7 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); @@ -548,7 +548,7 @@ a.throws(makeBlock(thrower, TypeError), function(err) { const g = {}; g.ref = g; - const h = {ref: g}; + const h = { ref: g }; a.doesNotThrow(makeBlock(a.deepEqual, f, h)); a.doesNotThrow(makeBlock(a.deepStrictEqual, f, h)); @@ -569,7 +569,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)); } @@ -606,7 +606,7 @@ a.throws(makeBlock(a.deepEqual, args, [])); })); } -const circular = {y: 1}; +const circular = { y: 1 }; circular.x = circular; function testAssertionMessage(actual, expected) { @@ -638,8 +638,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 @@ -727,7 +727,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 348b97b111658a..ff19d089a02099 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 ea5e59d319db53..c2d7bc76da64fb 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-buffer-alloc.js b/test/parallel/test-buffer-alloc.js index f86f31ec68811f..9e26c7aee6416e 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); diff --git a/test/parallel/test-buffer-compare-offset.js b/test/parallel/test-buffer-compare-offset.js index 037e82e055cb91..ae7d81df3aaecc 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)); diff --git a/test/parallel/test-buffer-from.js b/test/parallel/test-buffer-from.js index 214d8c67d2fc7d..ce20ff30bb3165 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); const err = new RegExp('^TypeError: First argument must be a string, Buffer, ' + diff --git a/test/parallel/test-buffer-sharedarraybuffer.js b/test/parallel/test-buffer-sharedarraybuffer.js index 582841d679c8d1..6c526bd6942734 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 a550906912a480..a1b39c88cec926 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 087a85243446d8..e1dcf85b0937b2 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-exec-cwd.js b/test/parallel/test-child-process-exec-cwd.js index f6719830c33538..c16f77f4c52906 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 2c585abcdf82a8..6418f91765028a 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.error('${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 aee99fbc7f3c59..06c6244eddaac4 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 de0ec6ca003045..1da92592ffc3ba 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 a88408674afd74..3eae2b242e9ce2 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 cb20ed8f70ca72..cdeb15975a7b5a 100644 --- a/test/parallel/test-child-process-fork-stdio-string-variant.js +++ b/test/parallel/test-child-process-fork-stdio-string-variant.js @@ -11,16 +11,16 @@ const fixtures = require('../common/fixtures'); const childScript = fixtures.path('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 89a5ff98e5f8a8..be0bdf19c35832 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 0056d4215b65b6..4b22b4060307ed 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 1ce7d3828275c5..2d8a28121ac1fb 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 00263a5d21550f..29dd45f6bdd7ee 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 bd61770cde4e34..b280e101810c54 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 b556c8bcf6ba32..a426fe8053bbd8 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 e9dd0e07efaa0c..e9a753e91a4e48 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 ff0b36150f15a2..6a03f185a43f52 100644 --- a/test/parallel/test-child-process-spawnsync-kill-signal.js +++ b/test/parallel/test-child-process-spawnsync-kill-signal.js @@ -11,7 +11,7 @@ if (process.argv[2] === 'child') { function spawn(killSignal) { const child = cp.spawnSync(process.execPath, [__filename, 'child'], - {killSignal, timeout: 100}); + { killSignal, timeout: 100 }); assert.strictEqual(child.status, null); assert.strictEqual(child.error.code, 'ETIMEDOUT'); diff --git a/test/parallel/test-child-process-spawnsync-shell.js b/test/parallel/test-child-process-spawnsync-shell.js index 9e03ee126f087b..12cd8486ca9286 100644 --- a/test/parallel/test-child-process-spawnsync-shell.js +++ b/test/parallel/test-child-process-spawnsync-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.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); @@ -16,7 +16,7 @@ else assert.strictEqual(doesNotExist.status, 127); // Exit code of /bin/sh // Verify that passing arguments works -const echo = cp.spawnSync('echo', ['foo'], {shell: true}); +const echo = cp.spawnSync('echo', ['foo'], { shell: true }); assert.strictEqual(echo.args[echo.args.length - 1].replace(/"/g, ''), 'echo foo'); @@ -24,13 +24,13 @@ 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 07d89059be33d5..35df6cee22f5f2 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 0d0a3dba566ad9..7b768d8403ac07 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 eda2d8841a8f5c..f1d18d437fd458 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 ec2cb9a31956c1..621884cea627ea 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-cli-bad-options.js b/test/parallel/test-cli-bad-options.js index 15a385b99f66d9..ebc434670ed4a7 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-syntax.js b/test/parallel/test-cli-syntax.js index 256334f21fd75c..1171a153e3ec25 100644 --- a/test/parallel/test-cli-syntax.js +++ b/test/parallel/test-cli-syntax.js @@ -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 1fde246525eae1..4ef319ae80d409 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 3688c67f6c68c8..5de04b3b7cb2d3 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 584881f05f63fe..59df0c54795ec2 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 d34ce11b0285ab..b0670f3e323671 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 c7bb46b2844add..ecf0862fa3bab5 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 95c5d84ea6dbb0..d19cf0c3811aa5 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 cc104ec44139f6..9abb42e4225567 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 9ae0f4a1192ac7..da503f67aa3a86 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 c58b6ed7d95001..1ce7a573cf6477 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 a8094e34df9c72..717969983d11ef 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 70d6a4df2a950c..c55e69e256950f 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 7dbe9fcb375caf..490000aeb6c42d 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 50832b3343cf86..647c39d939f2aa 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 0fcb765f207fb9..bca70467c0caac 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 ab952fa89230bd..0350015dc64003 100644 --- a/test/parallel/test-crypto-binary-default.js +++ b/test/parallel/test-crypto-binary-default.js @@ -47,19 +47,19 @@ const rsaKeyPem = fixtures.readSync('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 @@ -569,7 +569,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 58c72127a479fc..6262e083841617 100644 --- a/test/parallel/test-crypto.js +++ b/test/parallel/test-crypto.js @@ -41,7 +41,7 @@ const keyPem = fixtures.readSync('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 de7137d964d932..171b221ee2982c 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 586db5f3cfeb70..183faca1a43b6f 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 abbfb9d16b19e8..8142489a235869 100644 --- a/test/parallel/test-dns.js +++ b/test/parallel/test-dns.js @@ -166,7 +166,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(() => { @@ -176,7 +176,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 98e15a8437774b..99000563eba8c8 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 86df8db5b7423f..3a0768327383da 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 be4f4007f096df..d52d3b4f4e74ef 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-read-stream-inherit.js b/test/parallel/test-fs-read-stream-inherit.js index 8b1ca06950a98a..ddb07274d1f887 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 6e4f405daa8ff6..b6e1869fdc2cc9 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 eb216d2a4daaf7..04c10b5a4415c1 100644 --- a/test/parallel/test-fs-read-stream.js +++ b/test/parallel/test-fs-read-stream.js @@ -86,7 +86,7 @@ const rangeFile = fixtures.path('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 = fixtures.path('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 = fixtures.path('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 = fixtures.path('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 = fixtures.path('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 0ce6ec576dac69..84fd3dca24a329 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,27 @@ 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 +80,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 18b6f2ecf6a16b..5226899d2f33a8 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 8e27abb2517692..3e3746df1ef336 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 2c0e35719c40c6..d99de562bb2a8e 100644 --- a/test/parallel/test-fs-watchfile.js +++ b/test/parallel/test-fs-watchfile.js @@ -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 d888fcd3a3b7c1..570fe743fd1318 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 4bfa4ba5341e1e..df73d18b44210d 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 62627e1e32e192..5652e9e5e697cc 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 f3b69a4cd059dd..6d117035a5c727 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 f67d949bc8f5f6..47df50e2897b79 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 ecb76c1f5ed6db..6282aa3da7caf2 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-stream-end.js b/test/parallel/test-http-abort-stream-end.js index 1610c5ae6d44ad..8d2704a1ee7d17 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 server = http.createServer(common.mustCall((req, res) => { server.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-client-get-url.js b/test/parallel/test-http-client-get-url.js index 53ccd66182a663..7f6bfb8ecaa17b 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 81955996528e8f..4b9f168e9907f2 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 e1f8409a8cbd50..acd848c26532c1 100644 --- a/test/parallel/test-http-client-race-2.js +++ b/test/parallel/test-http-client-race-2.js @@ -45,7 +45,10 @@ const server = http.createServer(function(req, res) { } res.writeHead(200, - {'Content-Type': 'text/plain', 'Content-Length': body.length}); + { + '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 33c74ce370866a..d7ba5ed566e674 100644 --- a/test/parallel/test-http-client-race.js +++ b/test/parallel/test-http-client-race.js @@ -31,7 +31,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}); + { + '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 d29e37291dffde..8683b5726e2758 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 03dfabf0d7f0f8..bd303888bb63f9 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 e89bcfad5b5995..f1798b483f44fa 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 dab5711eb17833..ff73fd51cc5d73 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 b041f21ca8c196..641de122d57abd 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 a35611bb083d3d..bc5670b6939e39 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 b56c1302c2ad00..b778d07a826b1d 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 1e1f540cf01e04..000bf1d58424a3 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 565de21c7285ff..975e2abe881ac5 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 76634c5a830a72..723b710647682b 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 7dd9e1527c5d80..53f924d652dd75 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 6b02a98242f3d7..0b6ac5bdc1f7d0 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 bfc43a602b7018..b8045568d49ac7 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 8762c753206a80..23aea246d782f7 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 e63af7d3f09ecc..91d4d99b9a524e 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 f301b9169fcd2b..14ba8acd021f68 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 21be4c4d6d95e0..9e844e8a425af0 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 fa459a00e671a9..f5fb9466db1fa7 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 1dc65f72120e55..42d534e8e6b459 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 e0f719614edf48..59816b513b3af7 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 f43d4da42ef8a3..a3a51c015ec86f 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 80240c24ec8a59..202a185c7843e3 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 53a9a8e5f7841e..1ead3c14928d88 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 c6c414cccb15cc..4886a7d490e413 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 dfe3218a48fe7e..a6267faaa6715c 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 27db0a6a5ee568..525377d2e1ccbf 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 470f51a08fbc4e..d5dffdd2212da9 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 9be64e91a73fa7..3532d45c637c0d 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 7133e32429e7b1..32c6cf2e082668 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 0d519d60592922..fcf9da8c12b0e3 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 4261bb61ec2957..19b71fc31d7528 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 c915cb1d531808..14015475ca702d 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 5739dac31d690b..ccfc31192d3770 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 972ccfeb8c70cc..4e35b7e9d0c9a2 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 aebb6b813be35e..b14d59e59ce8f9 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-multiheaders.js b/test/parallel/test-http-server-multiheaders.js index 89d17d0f50774d..201a95c346ae65 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 265867abc6978e..c4a9151862ee6b 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 f316d86a7019dc..b3bc4295a84c0b 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 98217150376403..5dace4f7bfd706 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 77c0e4aa7e2849..b72c2b55a02f25 100644 --- a/test/parallel/test-http-server-stale-close.js +++ b/test/parallel/test-http-server-stale-close.js @@ -26,7 +26,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, @@ -35,7 +35,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(); diff --git a/test/parallel/test-http-server.js b/test/parallel/test-http-server.js index 85b2be52fef212..567f2b3b31b83b 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 6253a4cc8c0a4c..5440c23c215521 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 c267e5c82ee914..204207dfa8dcb6 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 6a100fdd624894..dd4709d6946a84 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 d48b71eb840738..802565f26bb697 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 d880309a5d3dd7..dc93b3da7ae20d 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 8c24f6e16b96b2..817bfe7a3c3be7 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 3b91afc03fbf7f..71a075831603da 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 5f38997872c500..ef06deefdf8afa 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 a20602e39d994c..35a7aca61b4030 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 e9d4950a4650df..d9fa581f3b55ce 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 2fc477c0b33c7b..3772fd3a10689f 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 f0e919ca648b05..705e779aacb762 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 76a12ef5d5dc0e..fa9baa528efa00 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 d1b95c779241b6..a66ab0ce8b1e8c 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 0bbf168471a72e..a0d2eaf1f3415a 100644 --- a/test/parallel/test-inspector-open.js +++ b/test/parallel/test-inspector-open.js @@ -19,7 +19,7 @@ const child = fork(__filename, 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)); })); @@ -31,7 +31,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; }); @@ -44,7 +44,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)); }); } @@ -54,7 +54,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)); }); } @@ -62,7 +62,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-intl.js b/test/parallel/test-intl.js index 5ce8cbc43c6c4e..983685c32cff04 100644 --- a/test/parallel/test-intl.js +++ b/test/parallel/test-intl.js @@ -67,7 +67,11 @@ if (!common.hasIntl) { // Construct an English formatter. Should format to "Jan 70" const dtf = new Intl.DateTimeFormat(['en'], - {timeZone: GMT, month: 'short', year: '2-digit'}); + { + 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 +93,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 82340c8bea13e1..0f09d386d5fa7c 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 5fe3169ee87382..e3d538c42b0bf6 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 8d3413d9aa7f33..88551889fe253c 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 209b90d71d0e84..1006a62d330054 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 68e63f0ba4cbc9..e0872cf7c5df3f 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 29b07645c452d3..aba07d9fcc8094 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 927bd95207370d..07c5446fc6c0ab 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 1a2bd850f3a54d..bc9e76df6546ee 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 58b184ff10f3e9..c9ba56b5aef035 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 a8a1346fec3370..cbe2d22052192d 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 09398bd0e36ceb..db8e639f94885f 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 494a331223fb5d..d2e70215dc1efb 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 2dbd588bafaf3b..53173fa66d120a 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 e015c24323ab86..84cc91d56c3b08 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 1e95fe6b0fb0f3..ae6bde49ab60cd 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 6d2d2fdd026333..d3a3d937d338ab 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 83893335f95b46..4f19c804065cb4 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 64e9429a2394f0..de9051caa88a14 100644 --- a/test/parallel/test-path-parse-format.js +++ b/test/parallel/test-path-parse-format.js @@ -55,12 +55,12 @@ const winSpecialCaseParseTests = [ ]; 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'], [{}, ''] ]; @@ -89,38 +89,38 @@ 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'], [{}, ''] ]; const errors = [ - {method: 'parse', input: [null], - message: /^TypeError: Path must be a string\. Received null$/}, - {method: 'parse', input: [{}], - message: /^TypeError: Path must be a string\. Received {}$/}, - {method: 'parse', input: [true], - message: /^TypeError: Path must be a string\. Received true$/}, - {method: 'parse', input: [1], - message: /^TypeError: Path must be a string\. Received 1$/}, - {method: 'parse', input: [], - message: /^TypeError: Path must be a string\. Received undefined$/}, - {method: 'format', input: [null], - message: - /^TypeError: Parameter "pathObject" must be an object, not object$/}, - {method: 'format', input: [''], - message: - /^TypeError: Parameter "pathObject" must be an object, not string$/}, - {method: 'format', input: [true], - message: - /^TypeError: Parameter "pathObject" must be an object, not boolean$/}, - {method: 'format', input: [1], - message: - /^TypeError: Parameter "pathObject" must be an object, not number$/}, + { method: 'parse', input: [null], + message: /^TypeError: Path must be a string\. Received null$/ }, + { method: 'parse', input: [{}], + message: /^TypeError: Path must be a string\. Received {}$/ }, + { method: 'parse', input: [true], + message: /^TypeError: Path must be a string\. Received true$/ }, + { method: 'parse', input: [1], + message: /^TypeError: Path must be a string\. Received 1$/ }, + { method: 'parse', input: [], + message: /^TypeError: Path must be a string\. Received undefined$/ }, + { method: 'format', input: [null], + message: + /^TypeError: Parameter "pathObject" must be an object, not object$/ }, + { method: 'format', input: [''], + message: + /^TypeError: Parameter "pathObject" must be an object, not string$/ }, + { method: 'format', input: [true], + message: + /^TypeError: Parameter "pathObject" must be an object, not boolean$/ }, + { method: 'format', input: [1], + message: + /^TypeError: Parameter "pathObject" must be an object, not number$/ }, ]; checkParseFormat(path.win32, winPaths); diff --git a/test/parallel/test-pipe-file-to-http.js b/test/parallel/test-pipe-file-to-http.js index ccb1c1c6129e0c..244dcd1a990fbf 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 a7b0b9a66ed7ab..77c30c3ad6bc79 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-external-stdio-close.js b/test/parallel/test-process-external-stdio-close.js index 798ee00d0511b0..067a75ec93492a 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.js b/test/parallel/test-process-redirect-warnings.js index b1097469b22b99..d38a2e97e25454 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 c62f19a0ae858f..fd20a8424fee96 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 da72dbf17cf969..e93577d162cff1 100644 --- a/test/parallel/test-querystring-maxKeys-non-finite.js +++ b/test/parallel/test-querystring-maxKeys-non-finite.js @@ -39,12 +39,13 @@ 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 a518d8da074445..8eef61e2a28f36 100644 --- a/test/parallel/test-querystring-multichar-separator.js +++ b/test/parallel/test-querystring-multichar-separator.js @@ -12,11 +12,13 @@ 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 42aa7437dd2c14..0e1900a91bb87c 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,36 @@ 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 +150,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 +225,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 +241,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 +343,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 +393,11 @@ 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 +406,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 +416,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 +436,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 e1be69af0c90f4..547d4feb8c2b5f 100644 --- a/test/parallel/test-readline-interface.js +++ b/test/parallel/test-readline-interface.js @@ -58,7 +58,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(); } diff --git a/test/parallel/test-readline.js b/test/parallel/test-readline.js index 4ec11fe8d817ab..82bf74549b2343 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 c5b0ae4982d993..37260b59e34721 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 5ec79b8685b409..d4d63600868470 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 678d6d5c6d94f8..091eaec1ab41be 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 b9bace5f7d982a..00b577cba73f76 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 7508e14d8bd024..d775423fb74a52 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 259c96fe8aa0f7..5ca8bf57a432b2 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 4ef2a633541494..2be272473b652a 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 d2ff29a4d12e89..6df856a20ec410 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 098f6fffbb697c..7b62ab57648a2f 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-stream-big-packet.js b/test/parallel/test-stream-big-packet.js index aeddfb2052451a..8575c3e43a46ee 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 96360429e58856..bd7332c7fabc50 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 916bd2cdfacf53..cd29b66365ae0f 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 befa24253d33f5..340502d1a98b7c 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 0bb8aa7bbc1c10..58b61bfdc1e8cf 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 65aee1d20d48cb..654b46254d8ee7 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 3c946f3b2f6df8..10259e280454c0 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 6d3da191b06cb9..27d31e50a96a7e 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 901f946a931944..f58ea4a32a1e7d 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 6b5593d93be9ef..0f12476f506a93 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 62707cf18c0ab7..a98d32c0b042d1 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 4e866726c19c22..7751f0fb2e03a1 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 e0547300c0a416..44699b20533f9d 100644 --- a/test/parallel/test-tls-alpn-server-client.js +++ b/test/parallel/test-tls-alpn-server-client.js @@ -32,7 +32,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() { @@ -47,8 +47,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++; @@ -83,16 +83,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(); }); @@ -116,16 +116,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(); }); @@ -149,16 +149,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(); }); @@ -176,16 +176,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(); }); @@ -210,15 +210,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(); }); @@ -240,14 +240,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(); }); @@ -269,15 +269,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(); }); @@ -293,15 +293,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(); }); @@ -326,15 +326,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(); }); @@ -356,14 +356,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(); }); @@ -385,15 +385,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(); }); @@ -409,15 +409,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(); }); @@ -440,15 +440,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(); }); @@ -468,15 +468,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(); }); @@ -496,15 +496,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(); }); @@ -518,15 +518,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 1d494b4ed3b76f..4c1e8ddd1974ee 100644 --- a/test/parallel/test-tls-basic-validations.js +++ b/test/parallel/test-tls-basic-validations.js @@ -7,31 +7,31 @@ 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' }), /TypeError: handshakeTimeout must be a number/); -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 b12c79fb05b9f5..be81420d154c08 100644 --- a/test/parallel/test-tls-client-abort.js +++ b/test/parallel/test-tls-client-abort.js @@ -31,7 +31,7 @@ const fixtures = require('../common/fixtures'); const cert = fixtures.readSync('test_cert.pem'); const key = fixtures.readSync('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 afacd5a39027a0..663e9399b610ce 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 304b55f1d6de3a..374f22d10e576a 100644 --- a/test/parallel/test-tls-connect.js +++ b/test/parallel/test-tls-connect.js @@ -36,7 +36,7 @@ const tls = require('tls'); 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( diff --git a/test/parallel/test-tls-delayed-attach-error.js b/test/parallel/test-tls-delayed-attach-error.js index 94d8e879adcd2d..69a35f011ea774 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 4dd12a78b6387c..80d9cc9ec3ecef 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: fixtures.path('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 df94d08297d9dd..b183309af71457 100644 --- a/test/parallel/test-tls-passphrase.js +++ b/test/parallel/test-tls-passphrase.js @@ -148,14 +148,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 @@ -163,7 +163,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 @@ -171,28 +171,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 @@ -200,7 +200,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 @@ -208,14 +208,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()); @@ -245,7 +245,7 @@ assert.throws(function() { assert.throws(function() { tls.connect({ port: server.address().port, - key: [{pem: passKey}], + key: [{ pem: passKey }], cert: cert, rejectUnauthorized: false }); @@ -277,7 +277,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 @@ -287,7 +287,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 d2b94d6eaefbd7..14c3d17cd24a76 100644 --- a/test/parallel/test-tls-peer-certificate.js +++ b/test/parallel/test-tls-peer-certificate.js @@ -30,7 +30,7 @@ const { } = require(fixtures.path('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 5d44356c661e97..9dceb4c4e4dd88 100644 --- a/test/parallel/test-tls-securepair-server.js +++ b/test/parallel/test-tls-securepair-server.js @@ -42,7 +42,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 b59f948b2d6861..0543e98a1667fa 100644 --- a/test/parallel/test-tls-socket-default-options.js +++ b/test/parallel/test-tls-socket-default-options.js @@ -17,19 +17,20 @@ 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) => { +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 16175b8898115e..a54b7170f08277 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-parse-query.js b/test/parallel/test-url-parse-query.js index 34c31d8a3ca229..c5a1a051556bd5 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 649bb63942909f..27e3b62476211c 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 ae6da3a34f8727..ed9e9d196af03f 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 1ebd3c6dee2665..dd174d0a3c4d82 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -52,33 +52,34 @@ 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), +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 }' @@ -90,14 +91,14 @@ assert.strictEqual(util.inspect((new JSStream())._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]) { @@ -241,7 +242,7 @@ for (const showHidden of [true, false]) { util.inspect( Object.create( {}, - {visible: {value: 1, enumerable: true}, hidden: {value: 2}} + { visible: { value: 1, enumerable: true }, hidden: { value: 2 } } ), true ); @@ -253,10 +254,17 @@ 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}`); @@ -265,21 +273,22 @@ for (const showHidden of [true, false]) { assert.strictEqual( util.inspect(Object.create(null, - {name: {value: 'Tim', enumerable: true}, - hidden: {value: 'secret'}})), + { name: { value: 'Tim', enumerable: true }, + hidden: { value: 'secret' } })), '{ name: \'Tim\' }' ); // Dynamic properties { - assert.strictEqual(util.inspect({get readonly() {}}), + 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) {}}), + assert.strictEqual(util.inspect({ set writeonly(val) {} }), '{ writeonly: [Setter] }'); const value = {}; @@ -696,7 +705,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)); } @@ -704,11 +713,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'] }); @@ -764,7 +773,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), @@ -1035,22 +1044,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); @@ -1069,7 +1079,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 d660106e1705af..907a361e97ecb8 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 eca6fe9ff7ecd4..b6dd383e1733c3 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 191f4361b4e356..3b2729c107b4b1 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-property-not-on-sandbox.js b/test/parallel/test-vm-property-not-on-sandbox.js index 08ea5890784c37..9f652f5dcfd23b 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 9a56543637dc55..163fa185ede58d 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 2dbf5aa1fbd0e4..0e01c627eea6e4 100644 --- a/test/parallel/test-whatwg-url-searchparams-sort.js +++ b/test/parallel/test-whatwg-url-searchparams-sort.js @@ -65,7 +65,7 @@ test(function() { // 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 913e71fa8d7a1a..75aaa2f48dd8f3 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 ba6bb5fb8a26b4..e4c673aff0fe09 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 01930b27207bf0..e4b39002fba724 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-not-string-or-buffer.js b/test/parallel/test-zlib-not-string-or-buffer.js index 16f127b3e557d3..d03d69fea10576 100644 --- a/test/parallel/test-zlib-not-string-or-buffer.js +++ b/test/parallel/test-zlib-not-string-or-buffer.js @@ -17,4 +17,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 29852528eec95b..671ecce7349e83 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 acccec8a829f46..9ae9922ec8b2d6 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 656943ec86c265..d3e540166c27a7 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 d2387495c1c288..479ec12948175e 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 6ac438287112cd..05e27628b14388 100644 --- a/test/pummel/test-regress-GH-892.js +++ b/test/pummel/test-regress-GH-892.js @@ -96,7 +96,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 b397197c0cb484..dbcd33d53466dc 100644 --- a/test/pummel/test-tls-securepair-client.js +++ b/test/pummel/test-tls-securepair-client.js @@ -117,7 +117,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-http.js b/test/sequential/test-benchmark-http.js index fb0c1390c545e2..b8d47fb8980db1 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-child-process-execsync.js b/test/sequential/test-child-process-execsync.js index 4fb2915010ef8d..63046517a9ca29 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 f9dda9ba1d1ce9..931763cf3c7091 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-init.js b/test/sequential/test-init.js index 1829905b42d24c..3c3653521d6fd3 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 282380ad271778..be33821bf6518c 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 c5295c0a2fe459..6eff05513fbec7 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 aad860f840ae09..455b8252753c27 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 0da272d5f670e3..e15287417693e0 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) } }); } }