Browse Source

lib,src: fix consistent spacing inside braces

PR-URL: https://github.com/nodejs/node/pull/14162
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
v6
Sebastiaan Deckers 8 years ago
committed by Refael Ackermann
parent
commit
bb29405904
No known key found for this signature in database GPG Key ID: CD704BD80FDDDB64
  1. 2
      benchmark/_test-double-benchmarker.js
  2. 2
      benchmark/crypto/aes-gcm-throughput.js
  3. 2
      benchmark/events/ee-add-remove.js
  4. 2
      benchmark/events/ee-emit-multi-args.js
  5. 2
      benchmark/events/ee-emit.js
  6. 2
      benchmark/events/ee-listener-count-on-prototype.js
  7. 2
      benchmark/events/ee-listeners-many.js
  8. 2
      benchmark/events/ee-listeners.js
  9. 2
      benchmark/events/ee-once.js
  10. 4
      benchmark/url/url-format.js
  11. 2
      benchmark/util/format.js
  12. 10
      benchmark/util/inspect-proxy.js
  13. 4
      benchmark/util/inspect.js
  14. 2
      benchmark/vm/run-in-context.js
  15. 2
      benchmark/vm/run-in-this-context.js
  16. 2
      lib/console.js
  17. 2
      lib/dgram.js
  18. 2
      lib/dns.js
  19. 8
      lib/fs.js
  20. 2
      lib/inspector.js
  21. 2
      lib/internal/bootstrap_node.js
  22. 8
      lib/internal/child_process.js
  23. 2
      lib/internal/cluster/master.js
  24. 2
      lib/internal/socket_list.js
  25. 4
      lib/internal/util.js
  26. 4
      lib/readline.js
  27. 2
      lib/repl.js
  28. 14
      test/addons-napi/test_make_callback_recurse/test.js
  29. 8
      test/addons-napi/test_object/test.js
  30. 14
      test/addons/make-callback-recurse/test.js
  31. 2
      test/async-hooks/test-promise.promise-before-init-hooks.js
  32. 4
      test/common/index.js
  33. 2
      test/debugger/helper-debugger-repl.js
  34. 2
      test/gc/test-http-client-onerror.js
  35. 2
      test/gc/test-http-client.js
  36. 6
      test/inspector/inspector-helper.js
  37. 4
      test/inspector/test-inspector-break-when-eval.js
  38. 10
      test/inspector/test-inspector-debug-brk.js
  39. 10
      test/inspector/test-inspector-exception.js
  40. 70
      test/inspector/test-inspector-port-cluster.js
  41. 14
      test/inspector/test-inspector.js
  42. 4
      test/internet/test-dgram-broadcast-multi-process.js
  43. 4
      test/internet/test-dns-ipv4.js
  44. 2
      test/internet/test-dns-ipv6.js
  45. 26
      test/internet/test-dns.js
  46. 2
      test/internet/test-tls-reuse-host-from-socket.js
  47. 6
      test/known_issues/test-stdin-is-always-net.socket.js
  48. 2
      test/known_issues/test-vm-inherited_properties.js
  49. 2
      test/known_issues/test-vm-proxy-failure-CP.js
  50. 2
      test/message/vm_display_runtime_error.js
  51. 28
      test/parallel/test-assert-deep.js
  52. 46
      test/parallel/test-assert.js
  53. 2
      test/parallel/test-async-hooks-http-agent.js
  54. 2
      test/parallel/test-async-hooks-promise.js
  55. 2
      test/parallel/test-benchmark-crypto.js
  56. 2
      test/parallel/test-benchmark-timers.js
  57. 10
      test/parallel/test-buffer-alloc.js
  58. 4
      test/parallel/test-buffer-compare-offset.js
  59. 22
      test/parallel/test-buffer-fill.js
  60. 2
      test/parallel/test-buffer-from.js
  61. 2
      test/parallel/test-buffer-read.js
  62. 2
      test/parallel/test-buffer-sharedarraybuffer.js
  63. 4
      test/parallel/test-buffer-tostring-range.js
  64. 19
      test/parallel/test-child-process-cwd.js
  65. 4
      test/parallel/test-child-process-env.js
  66. 2
      test/parallel/test-child-process-exec-cwd.js
  67. 4
      test/parallel/test-child-process-exec-maxBuffer.js
  68. 2
      test/parallel/test-child-process-fork-exec-path.js
  69. 14
      test/parallel/test-child-process-fork-net.js
  70. 2
      test/parallel/test-child-process-fork-ref.js
  71. 8
      test/parallel/test-child-process-fork-stdio-string-variant.js
  72. 2
      test/parallel/test-child-process-fork-stdio.js
  73. 4
      test/parallel/test-child-process-internal.js
  74. 2
      test/parallel/test-child-process-send-keep-open.js
  75. 2
      test/parallel/test-child-process-send-type-error.js
  76. 8
      test/parallel/test-child-process-silent.js
  77. 2
      test/parallel/test-child-process-spawn-argv0.js
  78. 4
      test/parallel/test-child-process-spawn-shell.js
  79. 2
      test/parallel/test-child-process-spawnsync-kill-signal.js
  80. 8
      test/parallel/test-child-process-spawnsync-shell.js
  81. 2
      test/parallel/test-child-process-spawnsync-timeout.js
  82. 6
      test/parallel/test-child-process-spawnsync.js
  83. 12
      test/parallel/test-child-process-stdio.js
  84. 4
      test/parallel/test-child-process-uid-gid.js
  85. 4
      test/parallel/test-child-process-validate-stdio.js
  86. 2
      test/parallel/test-cli-bad-options.js
  87. 4
      test/parallel/test-cli-node-options.js
  88. 6
      test/parallel/test-cli-syntax.js
  89. 4
      test/parallel/test-cluster-bind-twice.js
  90. 2
      test/parallel/test-cluster-dgram-1.js
  91. 2
      test/parallel/test-cluster-disconnect-unshared-tcp.js
  92. 2
      test/parallel/test-cluster-disconnect-unshared-udp.js
  93. 2
      test/parallel/test-cluster-eaccess.js
  94. 4
      test/parallel/test-cluster-ipc-throw.js
  95. 2
      test/parallel/test-cluster-master-error.js
  96. 2
      test/parallel/test-cluster-send-deadlock.js
  97. 2
      test/parallel/test-cluster-shared-handle-bind-error.js
  98. 2
      test/parallel/test-cluster-worker-constructor.js
  99. 2
      test/parallel/test-cluster-worker-disconnect-on-error.js
  100. 2
      test/parallel/test-cluster-worker-no-exit.js

2
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 }));
});

2
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'],

2
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;

2
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;

2
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;

2
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;

2
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;

2
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;

2
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;

4
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, {

2
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]
};

10
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);
}

4
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);
}

2
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');

2
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');

2
lib/console.js

@ -124,7 +124,7 @@ Console.prototype.error = Console.prototype.warn;
Console.prototype.dir = function dir(object, options) {
options = Object.assign({customInspect: false}, options);
options = Object.assign({ customInspect: false }, options);
write(this._ignoreErrors,
this._stdout,
`${util.inspect(object, options)}\n`,

2
lib/dgram.js

@ -408,7 +408,7 @@ Socket.prototype.send = function(buffer,
this._healthCheck();
if (this._bindState === BIND_STATE_UNBOUND)
this.bind({port: 0, exclusive: true}, null);
this.bind({ port: 0, exclusive: true }, null);
if (list.length === 0)
list.push(Buffer.alloc(0));

2
lib/dns.js

@ -164,7 +164,7 @@ function lookup(hostname, options, callback) {
if (matchedFamily) {
if (all) {
process.nextTick(
callback, null, [{address: hostname, family: matchedFamily}]);
callback, null, [{ address: hostname, family: matchedFamily }]);
} else {
process.nextTick(callback, null, hostname, matchedFamily);
}

8
lib/fs.js

@ -253,10 +253,10 @@ function statsFromValues() {
// Don't allow mode to accidentally be overwritten.
Object.defineProperties(fs, {
F_OK: {enumerable: true, value: constants.F_OK || 0},
R_OK: {enumerable: true, value: constants.R_OK || 0},
W_OK: {enumerable: true, value: constants.W_OK || 0},
X_OK: {enumerable: true, value: constants.X_OK || 0},
F_OK: { enumerable: true, value: constants.F_OK || 0 },
R_OK: { enumerable: true, value: constants.R_OK || 0 },
W_OK: { enumerable: true, value: constants.W_OK || 0 },
X_OK: { enumerable: true, value: constants.X_OK || 0 },
});
function handleError(val, callback) {

2
lib/inspector.js

@ -62,7 +62,7 @@ class Session extends EventEmitter {
throw new Error('Session is not connected');
}
const id = this[nextIdSymbol]++;
const message = {id, method};
const message = { id, method };
if (params) {
message['params'] = params;
}

2
lib/internal/bootstrap_node.js

@ -454,7 +454,7 @@
// wrap it
source = Module.wrap(source);
// compile the script, this will throw if it fails
new vm.Script(source, {displayErrors: true, filename});
new vm.Script(source, { displayErrors: true, filename });
}
// Below you find a minimal module system, which is used to load the node

8
lib/internal/child_process.js

@ -110,7 +110,7 @@ const handleConversion = {
},
got: function(message, handle, emit) {
var socket = new net.Socket({handle: handle});
var socket = new net.Socket({ handle: handle });
socket.readable = socket.writable = true;
// if the socket was created by net.Server we will track the socket
@ -584,7 +584,7 @@ function setupChannel(target, channel) {
options);
}
options = Object.assign({swallowErrors: false}, options);
options = Object.assign({ swallowErrors: false }, options);
if (this.connected) {
return this._send(message, handle, options, callback);
@ -606,7 +606,7 @@ function setupChannel(target, channel) {
// Support legacy function signature
if (typeof options === 'boolean') {
options = {swallowErrors: options};
options = { swallowErrors: options };
}
// package messages with a handle object
@ -840,7 +840,7 @@ function _validateStdio(stdio, sync) {
}
if (stdio === 'ignore') {
acc.push({type: 'ignore'});
acc.push({ type: 'ignore' });
} else if (stdio === 'pipe' || typeof stdio === 'number' && stdio < 0) {
var a = {
type: 'pipe',

2
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;

2
lib/internal/socket_list.js

@ -104,4 +104,4 @@ class SocketListReceive extends EventEmitter {
}
}
module.exports = {SocketListSend, SocketListReceive};
module.exports = { SocketListSend, SocketListReceive };

4
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;

4
lib/readline.js

@ -692,7 +692,7 @@ Interface.prototype._getDisplayPos = function(str) {
}
var cols = offset % col;
var rows = row + (offset - cols) / col;
return {cols: cols, rows: rows};
return { cols: cols, rows: rows };
};
@ -711,7 +711,7 @@ Interface.prototype._getCursorPos = function() {
rows++;
cols = 0;
}
return {cols: cols, rows: rows};
return { cols: cols, rows: rows };
};

2
lib/repl.js

@ -1055,7 +1055,7 @@ REPLServer.prototype.parseREPLKeyword = function(keyword, rest) {
REPLServer.prototype.defineCommand = function(keyword, cmd) {
if (typeof cmd === 'function') {
cmd = {action: cmd};
cmd = { action: cmd };
} else if (typeof cmd.action !== 'function') {
throw new errors.TypeError('ERR_INVALID_ARG_TYPE',
'action', 'function', cmd.action);

14
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');

8
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');

14
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');

2
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) {

4
test/common/index.js

@ -219,7 +219,7 @@ Object.defineProperty(exports, 'localhostIPv4', {
});
// opensslCli defined lazily to reduce overhead of spawnSync
Object.defineProperty(exports, 'opensslCli', {get: function() {
Object.defineProperty(exports, 'opensslCli', { get: function() {
if (opensslCli !== null) return opensslCli;
if (process.config.variables.node_shared_openssl) {
@ -238,7 +238,7 @@ Object.defineProperty(exports, 'opensslCli', {get: function() {
opensslCli = false;
}
return opensslCli;
}, enumerable: true});
}, enumerable: true });
Object.defineProperty(exports, 'hasCrypto', {
get: function() {

2
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 = [

2
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');
}

2
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');
}

6
test/inspector/inspector-helper.js

@ -90,7 +90,7 @@ function tearDown(child, err) {
}
function checkHttpResponse(host, port, path, callback, errorcb) {
const req = http.get({host, port, path}, function(res) {
const req = http.get({ host, port, path }, function(res) {
let response = '';
res.setEncoding('utf8');
res
@ -377,7 +377,7 @@ function Harness(port, childProcess) {
this.stderrFilters_ = pending;
}));
childProcess.on('exit', (code, signal) => {
this.result_ = {code, signal};
this.result_ = { code, signal };
this.running_ = false;
});
}
@ -483,7 +483,7 @@ Harness.prototype.expectShutDown = function(errorCode) {
const timeoutId = timeout('Have not terminated');
this.process_.on('exit', (code, signal) => {
clearTimeout(timeoutId);
assert.strictEqual(errorCode, code, JSON.stringify({code, signal}));
assert.strictEqual(errorCode, code, JSON.stringify({ code, signal }));
callback();
});
} else {

4
test/inspector/test-inspector-break-when-eval.js

@ -59,7 +59,7 @@ function setupDebugger(session) {
{ 'method': 'Runtime.enable' },
{ 'method': 'Debugger.enable' },
{ 'method': 'Debugger.setAsyncCallStackDepth',
'params': {'maxDepth': 0} },
'params': { 'maxDepth': 0 } },
{ 'method': 'Runtime.runIfWaitingForDebugger' },
];
@ -106,7 +106,7 @@ function stepOverConsoleStatement(session) {
function testWaitsForFrontendDisconnect(session, harness) {
console.log('[test]', 'Verify node waits for the frontend to disconnect');
session.sendInspectorCommands({ 'method': 'Debugger.resume'})
session.sendInspectorCommands({ 'method': 'Debugger.resume' })
.expectMessages(setupExpectContextDestroyed(1))
.expectStderrOutput('Waiting for the debugger to disconnect...')
.disconnect(true);

10
test/inspector/test-inspector-debug-brk.js

@ -25,14 +25,14 @@ function testBreakpointOnStart(session) {
{ 'method': 'Runtime.enable' },
{ 'method': 'Debugger.enable' },
{ 'method': 'Debugger.setPauseOnExceptions',
'params': {'state': 'none'} },
'params': { 'state': 'none' } },
{ 'method': 'Debugger.setAsyncCallStackDepth',
'params': {'maxDepth': 0} },
'params': { 'maxDepth': 0 } },
{ 'method': 'Profiler.enable' },
{ 'method': 'Profiler.setSamplingInterval',
'params': {'interval': 100} },
'params': { 'interval': 100 } },
{ 'method': 'Debugger.setBlackboxPatterns',
'params': {'patterns': []} },
'params': { 'patterns': [] } },
{ 'method': 'Runtime.runIfWaitingForDebugger' }
];
@ -43,7 +43,7 @@ function testBreakpointOnStart(session) {
function testWaitsForFrontendDisconnect(session, harness) {
console.log('[test]', 'Verify node waits for the frontend to disconnect');
session.sendInspectorCommands({ 'method': 'Debugger.resume'})
session.sendInspectorCommands({ 'method': 'Debugger.resume' })
.expectStderrOutput('Waiting for the debugger to disconnect...')
.disconnect(true);
}

10
test/inspector/test-inspector-exception.js

@ -27,14 +27,14 @@ function testBreakpointOnStart(session) {
{ 'method': 'Runtime.enable' },
{ 'method': 'Debugger.enable' },
{ 'method': 'Debugger.setPauseOnExceptions',
'params': {'state': 'none'} },
'params': { 'state': 'none' } },
{ 'method': 'Debugger.setAsyncCallStackDepth',
'params': {'maxDepth': 0} },
'params': { 'maxDepth': 0 } },
{ 'method': 'Profiler.enable' },
{ 'method': 'Profiler.setSamplingInterval',
'params': {'interval': 100} },
'params': { 'interval': 100 } },
{ 'method': 'Debugger.setBlackboxPatterns',
'params': {'patterns': []} },
'params': { 'patterns': [] } },
{ 'method': 'Runtime.runIfWaitingForDebugger' }
];
@ -45,7 +45,7 @@ function testBreakpointOnStart(session) {
function testWaitsForFrontendDisconnect(session, harness) {
console.log('[test]', 'Verify node waits for the frontend to disconnect');
session.sendInspectorCommands({ 'method': 'Debugger.resume'})
session.sendInspectorCommands({ 'method': 'Debugger.resume' })
.expectStderrOutput('Waiting for the debugger to disconnect...')
.disconnect(true);
}

70
test/inspector/test-inspector-port-cluster.js

@ -20,7 +20,7 @@ let offset = 0;
function testRunnerMain() {
let defaultPortCase = spawnMaster({
execArgv: ['--inspect'],
workers: [{expectedPort: 9230}]
workers: [{ expectedPort: 9230 }]
});
let port = debuggerPort + offset++ * 5;
@ -28,9 +28,9 @@ function testRunnerMain() {
spawnMaster({
execArgv: [`--inspect=${port}`],
workers: [
{expectedPort: port + 1},
{expectedPort: port + 2},
{expectedPort: port + 3}
{ expectedPort: port + 1 },
{ expectedPort: port + 2 },
{ expectedPort: port + 3 }
]
});
@ -38,28 +38,28 @@ function testRunnerMain() {
spawnMaster({
execArgv: ['--inspect', `--inspect-port=${port}`],
workers: [{expectedPort: port + 1}]
workers: [{ expectedPort: port + 1 }]
});
port = debuggerPort + offset++ * 5;
spawnMaster({
execArgv: ['--inspect', `--debug-port=${port}`],
workers: [{expectedPort: port + 1}]
workers: [{ expectedPort: port + 1 }]
});
port = debuggerPort + offset++ * 5;
spawnMaster({
execArgv: [`--inspect=0.0.0.0:${port}`],
workers: [{expectedPort: port + 1, expectedHost: '0.0.0.0'}]
workers: [{ expectedPort: port + 1, expectedHost: '0.0.0.0' }]
});
port = debuggerPort + offset++ * 5;
spawnMaster({
execArgv: [`--inspect=127.0.0.1:${port}`],
workers: [{expectedPort: port + 1, expectedHost: '127.0.0.1'}]
workers: [{ expectedPort: port + 1, expectedHost: '127.0.0.1' }]
});
if (common.hasIPv6) {
@ -67,14 +67,14 @@ function testRunnerMain() {
spawnMaster({
execArgv: [`--inspect=[::]:${port}`],
workers: [{expectedPort: port + 1, expectedHost: '::'}]
workers: [{ expectedPort: port + 1, expectedHost: '::' }]
});
port = debuggerPort + offset++ * 5;
spawnMaster({
execArgv: [`--inspect=[::1]:${port}`],
workers: [{expectedPort: port + 1, expectedHost: '::1'}]
workers: [{ expectedPort: port + 1, expectedHost: '::1' }]
});
}
@ -85,18 +85,18 @@ function testRunnerMain() {
spawnMaster({
execArgv: [`--inspect=${port}`],
clusterSettings: {inspectPort: port + 2},
workers: [{expectedPort: port + 2}]
clusterSettings: { inspectPort: port + 2 },
workers: [{ expectedPort: port + 2 }]
});
port = debuggerPort + offset++ * 5;
spawnMaster({
execArgv: [`--inspect=${port}`],
clusterSettings: {inspectPort: 'addTwo'},
clusterSettings: { inspectPort: 'addTwo' },
workers: [
{expectedPort: port + 2},
{expectedPort: port + 4}
{ expectedPort: port + 2 },
{ expectedPort: port + 4 }
]
});
@ -104,7 +104,7 @@ function testRunnerMain() {
spawnMaster({
execArgv: [`--inspect=${port}`],
clusterSettings: {inspectPort: 'string'},
clusterSettings: { inspectPort: 'string' },
workers: [{}]
});
@ -112,7 +112,7 @@ function testRunnerMain() {
spawnMaster({
execArgv: [`--inspect=${port}`],
clusterSettings: {inspectPort: 'null'},
clusterSettings: { inspectPort: 'null' },
workers: [{}]
});
@ -120,7 +120,7 @@ function testRunnerMain() {
spawnMaster({
execArgv: [`--inspect=${port}`],
clusterSettings: {inspectPort: 'bignumber'},
clusterSettings: { inspectPort: 'bignumber' },
workers: [{}]
});
@ -128,7 +128,7 @@ function testRunnerMain() {
spawnMaster({
execArgv: [`--inspect=${port}`],
clusterSettings: {inspectPort: 'negativenumber'},
clusterSettings: { inspectPort: 'negativenumber' },
workers: [{}]
});
@ -136,7 +136,7 @@ function testRunnerMain() {
spawnMaster({
execArgv: [`--inspect=${port}`],
clusterSettings: {inspectPort: 'bignumberfunc'},
clusterSettings: { inspectPort: 'bignumberfunc' },
workers: [{}]
});
@ -144,7 +144,7 @@ function testRunnerMain() {
spawnMaster({
execArgv: [`--inspect=${port}`],
clusterSettings: {inspectPort: 'strfunc'},
clusterSettings: { inspectPort: 'strfunc' },
workers: [{}]
});
@ -152,9 +152,9 @@ function testRunnerMain() {
spawnMaster({
execArgv: [],
clusterSettings: {inspectPort: port, execArgv: ['--inspect']},
clusterSettings: { inspectPort: port, execArgv: ['--inspect'] },
workers: [
{expectedPort: port}
{ expectedPort: port }
]
});
@ -162,11 +162,11 @@ function testRunnerMain() {
spawnMaster({
execArgv: [`--inspect=${port}`],
clusterSettings: {inspectPort: 0},
clusterSettings: { inspectPort: 0 },
workers: [
{expectedInitialPort: 0},
{expectedInitialPort: 0},
{expectedInitialPort: 0}
{ expectedInitialPort: 0 },
{ expectedInitialPort: 0 },
{ expectedInitialPort: 0 }
]
});
@ -174,11 +174,11 @@ function testRunnerMain() {
spawnMaster({
execArgv: [],
clusterSettings: {inspectPort: 0},
clusterSettings: { inspectPort: 0 },
workers: [
{expectedInitialPort: 0},
{expectedInitialPort: 0},
{expectedInitialPort: 0}
{ expectedInitialPort: 0 },
{ expectedInitialPort: 0 },
{ expectedInitialPort: 0 }
]
});
@ -186,9 +186,9 @@ function testRunnerMain() {
port = debuggerPort + offset++ * 5;
defaultPortCase = spawnMaster({
execArgv: ['--inspect'],
clusterSettings: {inspectPort: port + 2},
clusterSettings: { inspectPort: port + 2 },
workers: [
{expectedInitialPort: port + 2}
{ expectedInitialPort: port + 2 }
]
});
});
@ -290,7 +290,7 @@ function masterProcessMain() {
}
function workerProcessMain() {
const {expectedPort, expectedInitialPort, expectedHost} = process.env;
const { expectedPort, expectedInitialPort, expectedHost } = process.env;
const debugOptions = process.binding('config').debugOptions;
if ('expectedPort' in process.env) {
@ -308,7 +308,7 @@ function workerProcessMain() {
process.exit();
}
function spawnMaster({execArgv, workers, clusterSettings = {}}) {
function spawnMaster({ execArgv, workers, clusterSettings = {} }) {
return new Promise((resolve) => {
childProcess.fork(__filename, {
env: {

14
test/inspector/test-inspector.js

@ -103,14 +103,14 @@ function testBreakpointOnStart(session) {
{ 'method': 'Runtime.enable' },
{ 'method': 'Debugger.enable' },
{ 'method': 'Debugger.setPauseOnExceptions',
'params': {'state': 'none'} },
'params': { 'state': 'none' } },
{ 'method': 'Debugger.setAsyncCallStackDepth',
'params': {'maxDepth': 0} },
'params': { 'maxDepth': 0 } },
{ 'method': 'Profiler.enable' },
{ 'method': 'Profiler.setSamplingInterval',
'params': {'interval': 100} },
'params': { 'interval': 100 } },
{ 'method': 'Debugger.setBlackboxPatterns',
'params': {'patterns': []} },
'params': { 'patterns': [] } },
{ 'method': 'Runtime.runIfWaitingForDebugger' }
];
@ -129,7 +129,7 @@ function testSetBreakpointAndResume(session) {
'condition': ''
}
},
{ 'method': 'Debugger.resume'},
{ 'method': 'Debugger.resume' },
[ { 'method': 'Debugger.getScriptSource',
'params': { 'scriptId': session.mainScriptId } },
expectMainScriptSource ],
@ -155,7 +155,7 @@ function testInspectScope(session) {
'accessorPropertiesOnly': false,
'generatePreview': true
}
}, setupExpectScopeValues({t: 1001, k: 1})
}, setupExpectScopeValues({ t: 1001, k: 1 })
],
[
{
@ -211,7 +211,7 @@ function testI18NCharacters(session) {
function testWaitsForFrontendDisconnect(session, harness) {
console.log('[test]', 'Verify node waits for the frontend to disconnect');
session.sendInspectorCommands({ 'method': 'Debugger.resume'})
session.sendInspectorCommands({ 'method': 'Debugger.resume' })
.expectMessages(setupExpectContextDestroyed(1))
.expectStderrOutput('Waiting for the debugger to disconnect...')
.disconnect(true);

4
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);

4
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));

2
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));

26
test/internet/test-dns.js

@ -403,22 +403,26 @@ TEST(function test_lookup_failure(done) {
TEST(function test_lookup_ip_all(done) {
const req = dns.lookup('127.0.0.1', {all: true}, function(err, ips, family) {
assert.ifError(err);
assert.ok(Array.isArray(ips));
assert.ok(ips.length > 0);
assert.strictEqual(ips[0].address, '127.0.0.1');
assert.strictEqual(ips[0].family, 4);
const req = dns.lookup(
'127.0.0.1',
{ all: true },
function(err, ips, family) {
assert.ifError(err);
assert.ok(Array.isArray(ips));
assert.ok(ips.length > 0);
assert.strictEqual(ips[0].address, '127.0.0.1');
assert.strictEqual(ips[0].family, 4);
done();
});
done();
}
);
checkWrap(req);
});
TEST(function test_lookup_ip_all_promise(done) {
const req = util.promisify(dns.lookup)('127.0.0.1', {all: true})
const req = util.promisify(dns.lookup)('127.0.0.1', { all: true })
.then(function(ips) {
assert.ok(Array.isArray(ips));
assert.ok(ips.length > 0);
@ -444,7 +448,7 @@ TEST(function test_lookup_ip_promise(done) {
TEST(function test_lookup_null_all(done) {
const req = dns.lookup(null, {all: true}, function(err, ips, family) {
const req = dns.lookup(null, { all: true }, function(err, ips, family) {
assert.ifError(err);
assert.ok(Array.isArray(ips));
assert.strictEqual(ips.length, 0);
@ -457,7 +461,7 @@ TEST(function test_lookup_null_all(done) {
TEST(function test_lookup_all_mixed(done) {
const req = dns.lookup('www.google.com', {all: true}, function(err, ips) {
const req = dns.lookup('www.google.com', { all: true }, function(err, ips) {
assert.ifError(err);
assert.ok(Array.isArray(ips));
assert.ok(ips.length > 0);

2
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');
}));

6
test/known_issues/test-stdin-is-always-net.socket.js

@ -11,7 +11,11 @@ if (process.argv[2] === 'child') {
return;
}
const proc = spawn(process.execPath, [__filename, 'child'], {stdio: 'ignore'});
const proc = spawn(
process.execPath,
[__filename, 'child'],
{ stdio: 'ignore' }
);
// To double-check this test, set stdio to 'pipe' and uncomment the line below.
// proc.stderr.pipe(process.stderr);
proc.on('exit', common.mustCall(function(exitCode) {

2
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);

2
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);

2
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);
}

28
test/parallel/test-assert-deep.js

@ -86,8 +86,8 @@ assert.throws(() => assert.deepStrictEqual(re1, re2),
// For these weird cases, deepEqual should pass (at least for now),
// but deepStrictEqual should throw.
const similar = new Set([
{0: '1'}, // Object
{0: 1}, // Object
{ 0: '1' }, // Object
{ 0: 1 }, // Object
new String('1'), // Object
['1'], // Array
[1], // Array
@ -115,7 +115,7 @@ for (const a of similar) {
}
common.expectsError(() => {
assert.deepEqual(new Set([{a: 0}]), new Set([{a: 1}]));
assert.deepEqual(new Set([{ a: 0 }]), new Set([{ a: 1 }]));
}, {
code: 'ERR_ASSERTION',
message: /^Set { { a: 0 } } deepEqual Set { { a: 1 } }$/
@ -181,7 +181,7 @@ assertNotDeepOrStrict(new Set([1]), [1]);
assertNotDeepOrStrict(new Set(), []);
assertNotDeepOrStrict(new Set(), {});
assertNotDeepOrStrict(new Map([['a', 1]]), {a: 1});
assertNotDeepOrStrict(new Map([['a', 1]]), { a: 1 });
assertNotDeepOrStrict(new Map(), []);
assertNotDeepOrStrict(new Map(), {});
@ -195,24 +195,24 @@ assertDeepAndStrictEqual(new Set([{}]), new Set([{}]));
// Ref: https://github.com/nodejs/node/issues/13347
assertNotDeepOrStrict(
new Set([{a: 1}, {a: 1}]),
new Set([{a: 1}, {a: 2}])
new Set([{ a: 1 }, { a: 1 }]),
new Set([{ a: 1 }, { a: 2 }])
);
assertNotDeepOrStrict(
new Set([{a: 1}, {a: 1}, {a: 2}]),
new Set([{a: 1}, {a: 2}, {a: 2}])
new Set([{ a: 1 }, { a: 1 }, { a: 2 }]),
new Set([{ a: 1 }, { a: 2 }, { a: 2 }])
);
assertNotDeepOrStrict(
new Map([[{x: 1}, 5], [{x: 1}, 5]]),
new Map([[{x: 1}, 5], [{x: 2}, 5]])
new Map([[{ x: 1 }, 5], [{ x: 1 }, 5]]),
new Map([[{ x: 1 }, 5], [{ x: 2 }, 5]])
);
assertNotDeepOrStrict(new Set([3, '3']), new Set([3, 4]));
assertNotDeepOrStrict(new Map([[3, 0], ['3', 0]]), new Map([[3, 0], [4, 0]]));
assertNotDeepOrStrict(
new Set([{a: 1}, {a: 1}, {a: 2}]),
new Set([{a: 1}, {a: 2}, {a: 2}])
new Set([{ a: 1 }, { a: 1 }, { a: 2 }]),
new Set([{ a: 1 }, { a: 2 }, { a: 2 }])
);
// Mixed primitive and object keys
@ -319,7 +319,7 @@ assertOnlyDeepEqual(
assertDeepAndStrictEqual(new Set(values), new Set(values));
assertDeepAndStrictEqual(new Set(values), new Set(values.reverse()));
const mapValues = values.map((v) => [v, {a: 5}]);
const mapValues = values.map((v) => [v, { a: 5 }]);
assertDeepAndStrictEqual(new Map(mapValues), new Map(mapValues));
assertDeepAndStrictEqual(new Map(mapValues), new Map(mapValues.reverse()));
}
@ -337,7 +337,7 @@ assertOnlyDeepEqual(
{
const m1 = new Map();
const m2 = new Map();
const obj = {a: 5, b: 6};
const obj = { a: 5, b: 6 };
m1.set(1, obj);
m1.set(2, 'hi');
m1.set(3, [1, 2, 3]);

46
test/parallel/test-assert.js

@ -163,14 +163,14 @@ assert.throws(makeBlock(a.deepEqual, 4, '5'),
'deepEqual( 4, \'5\')');
// having the same number of owned properties && the same set of keys
assert.doesNotThrow(makeBlock(a.deepEqual, {a: 4}, {a: 4}));
assert.doesNotThrow(makeBlock(a.deepEqual, {a: 4, b: '2'}, {a: 4, b: '2'}));
assert.doesNotThrow(makeBlock(a.deepEqual, { a: 4 }, { a: 4 }));
assert.doesNotThrow(makeBlock(a.deepEqual, { a: 4, b: '2' }, { a: 4, b: '2' }));
assert.doesNotThrow(makeBlock(a.deepEqual, [4], ['4']));
assert.throws(makeBlock(a.deepEqual, {a: 4}, {a: 4, b: true}),
assert.throws(makeBlock(a.deepEqual, { a: 4 }, { a: 4, b: true }),
a.AssertionError);
assert.doesNotThrow(makeBlock(a.deepEqual, ['a'], {0: 'a'}));
assert.doesNotThrow(makeBlock(a.deepEqual, ['a'], { 0: 'a' }));
//(although not necessarily the same order),
assert.doesNotThrow(makeBlock(a.deepEqual, {a: 4, b: '1'}, {b: '1', a: 4}));
assert.doesNotThrow(makeBlock(a.deepEqual, { a: 4, b: '1' }, { b: '1', a: 4 }));
const a1 = [1, 2, 3];
const a2 = [1, 2, 3];
a1.a = 'test';
@ -213,7 +213,7 @@ assert.doesNotThrow(makeBlock(a.deepEqual, nb1, nb2));
assert.throws(makeBlock(a.deepEqual, null, {}), a.AssertionError);
assert.throws(makeBlock(a.deepEqual, undefined, {}), a.AssertionError);
assert.throws(makeBlock(a.deepEqual, 'a', ['a']), a.AssertionError);
assert.throws(makeBlock(a.deepEqual, 'a', {0: 'a'}), a.AssertionError);
assert.throws(makeBlock(a.deepEqual, 'a', { 0: 'a' }), a.AssertionError);
assert.throws(makeBlock(a.deepEqual, 1, {}), a.AssertionError);
assert.throws(makeBlock(a.deepEqual, true, {}), a.AssertionError);
assert.throws(makeBlock(a.deepEqual, Symbol(), {}), a.AssertionError);
@ -221,7 +221,7 @@ assert.throws(makeBlock(a.deepEqual, Symbol(), {}), a.AssertionError);
// primitive wrappers and object
assert.doesNotThrow(makeBlock(a.deepEqual, new String('a'), ['a']),
a.AssertionError);
assert.doesNotThrow(makeBlock(a.deepEqual, new String('a'), {0: 'a'}),
assert.doesNotThrow(makeBlock(a.deepEqual, new String('a'), { 0: 'a' }),
a.AssertionError);
assert.doesNotThrow(makeBlock(a.deepEqual, new Number(1), {}),
a.AssertionError);
@ -229,7 +229,7 @@ assert.doesNotThrow(makeBlock(a.deepEqual, new Boolean(true), {}),
a.AssertionError);
// same number of keys but different key names
assert.throws(makeBlock(a.deepEqual, {a: 1}, {b: 1}), a.AssertionError);
assert.throws(makeBlock(a.deepEqual, { a: 1 }, { b: 1 }), a.AssertionError);
//deepStrictEqual
assert.doesNotThrow(
@ -314,23 +314,23 @@ assert.throws(makeBlock(a.deepStrictEqual, 4, '5'),
'deepStrictEqual(4, \'5\')');
// having the same number of owned properties && the same set of keys
assert.doesNotThrow(makeBlock(a.deepStrictEqual, {a: 4}, {a: 4}));
assert.doesNotThrow(makeBlock(a.deepStrictEqual, { a: 4 }, { a: 4 }));
assert.doesNotThrow(makeBlock(a.deepStrictEqual,
{a: 4, b: '2'},
{a: 4, b: '2'}));
{ a: 4, b: '2' },
{ a: 4, b: '2' }));
assert.throws(makeBlock(a.deepStrictEqual, [4], ['4']),
common.expectsError({
code: 'ERR_ASSERTION',
type: a.AssertionError,
message: /^\[ 4 ] deepStrictEqual \[ '4' ]$/
}));
assert.throws(makeBlock(a.deepStrictEqual, {a: 4}, {a: 4, b: true}),
assert.throws(makeBlock(a.deepStrictEqual, { a: 4 }, { a: 4, b: true }),
common.expectsError({
code: 'ERR_ASSERTION',
type: a.AssertionError,
message: /^{ a: 4 } deepStrictEqual { a: 4, b: true }$/
}));
assert.throws(makeBlock(a.deepStrictEqual, ['a'], {0: 'a'}),
assert.throws(makeBlock(a.deepStrictEqual, ['a'], { 0: 'a' }),
common.expectsError({
code: 'ERR_ASSERTION',
type: a.AssertionError,
@ -338,8 +338,8 @@ assert.throws(makeBlock(a.deepStrictEqual, ['a'], {0: 'a'}),
}));
//(although not necessarily the same order),
assert.doesNotThrow(makeBlock(a.deepStrictEqual,
{a: 4, b: '1'},
{b: '1', a: 4}));
{ a: 4, b: '1' },
{ b: '1', a: 4 }));
assert.throws(makeBlock(a.deepStrictEqual,
[0, 1, 2, 'a', 'b'],
@ -385,7 +385,7 @@ assert.doesNotThrow(makeBlock(assert.deepStrictEqual, s, s));
assert.throws(makeBlock(a.deepStrictEqual, null, {}), a.AssertionError);
assert.throws(makeBlock(a.deepStrictEqual, undefined, {}), a.AssertionError);
assert.throws(makeBlock(a.deepStrictEqual, 'a', ['a']), a.AssertionError);
assert.throws(makeBlock(a.deepStrictEqual, 'a', {0: 'a'}), a.AssertionError);
assert.throws(makeBlock(a.deepStrictEqual, 'a', { 0: 'a' }), a.AssertionError);
assert.throws(makeBlock(a.deepStrictEqual, 1, {}), a.AssertionError);
assert.throws(makeBlock(a.deepStrictEqual, true, {}), a.AssertionError);
assert.throws(makeBlock(assert.deepStrictEqual, Symbol(), {}),
@ -395,7 +395,7 @@ assert.throws(makeBlock(assert.deepStrictEqual, Symbol(), {}),
// primitive wrappers and object
assert.throws(makeBlock(a.deepStrictEqual, new String('a'), ['a']),
a.AssertionError);
assert.throws(makeBlock(a.deepStrictEqual, new String('a'), {0: 'a'}),
assert.throws(makeBlock(a.deepStrictEqual, new String('a'), { 0: 'a' }),
a.AssertionError);
assert.throws(makeBlock(a.deepStrictEqual, new Number(1), {}),
a.AssertionError);
@ -576,7 +576,7 @@ a.throws(makeBlock(thrower, TypeError), function(err) {
const g = {};
g.ref = g;
const h = {ref: g};
const h = { ref: g };
a.throws(makeBlock(a.deepEqual, f, h), /AssertionError/);
a.throws(makeBlock(a.deepStrictEqual, f, h), /AssertionError/);
@ -597,7 +597,7 @@ a.throws(makeBlock(a.deepEqual, args, []));
a.throws(makeBlock(a.deepEqual, someArgs, ['a']));
a.throws(makeBlock(a.deepEqual, ['a'], someArgs));
a.throws(makeBlock(a.deepEqual, someArgs, {'0': 'a'}));
a.throws(makeBlock(a.deepEqual, someArgs, { '0': 'a' }));
a.throws(makeBlock(a.deepEqual, someArgs, diffArgs));
a.doesNotThrow(makeBlock(a.deepEqual, someArgs, sameArgs));
}
@ -634,7 +634,7 @@ a.throws(makeBlock(a.deepEqual, args, []));
}));
}
const circular = {y: 1};
const circular = { y: 1 };
circular.x = circular;
function testAssertionMessage(actual, expected) {
@ -666,8 +666,8 @@ testAssertionMessage(function f() {}, '[Function: f]');
testAssertionMessage(function() {}, '[Function]');
testAssertionMessage({}, '{}');
testAssertionMessage(circular, '{ y: 1, x: [Circular] }');
testAssertionMessage({a: undefined, b: null}, '{ a: undefined, b: null }');
testAssertionMessage({a: NaN, b: Infinity, c: -Infinity},
testAssertionMessage({ a: undefined, b: null }, '{ a: undefined, b: null }');
testAssertionMessage({ a: NaN, b: Infinity, c: -Infinity },
'{ a: NaN, b: Infinity, c: -Infinity }');
// #2893
@ -755,7 +755,7 @@ assert.throws(() => {
assert.strictEqual('A'.repeat(1000), '');
}, common.expectsError({
code: 'ERR_ASSERTION',
message: new RegExp(`^'${'A'.repeat(127)} === ''$`)}));
message: new RegExp(`^'${'A'.repeat(127)} === ''$`) }));
{
// bad args to AssertionError constructor should throw TypeError

2
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(() => {

2
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();

2
test/parallel/test-benchmark-crypto.js

@ -27,7 +27,7 @@ const argv = ['--set', 'algo=sha256',
'--set', 'writes=1',
'crypto'];
const child = fork(runjs, argv, {env: {NODEJS_BENCHMARK_ZERO_ALLOWED: 1}});
const child = fork(runjs, argv, { env: { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 } });
child.on('exit', (code, signal) => {
assert.strictEqual(code, 0);
assert.strictEqual(signal, null);

2
test/parallel/test-benchmark-timers.js

@ -14,7 +14,7 @@ const argv = ['--set', 'thousands=0.001',
'--set', 'millions=0.000001',
'timers'];
const child = fork(runjs, argv, {env: {NODEJS_BENCHMARK_ZERO_ALLOWED: 1}});
const child = fork(runjs, argv, { env: { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 } });
child.on('exit', (code, signal) => {
assert.strictEqual(code, 0);
assert.strictEqual(signal, null);

10
test/parallel/test-buffer-alloc.js

@ -266,10 +266,10 @@ assert.doesNotThrow(() => Buffer.alloc(1).write('', 1, 0));
// Test construction from arrayish object
{
const arrayIsh = {0: 0, 1: 1, 2: 2, 3: 3, length: 4};
const arrayIsh = { 0: 0, 1: 1, 2: 2, 3: 3, length: 4 };
let g = Buffer.from(arrayIsh);
assert.deepStrictEqual(g, Buffer.from([0, 1, 2, 3]));
const strArrayIsh = {0: '0', 1: '1', 2: '2', 3: '3', length: 4};
const strArrayIsh = { 0: '0', 1: '1', 2: '2', 3: '3', length: 4 };
g = Buffer.from(strArrayIsh);
assert.deepStrictEqual(g, Buffer.from([0, 1, 2, 3]));
}
@ -754,8 +754,8 @@ Buffer.allocUnsafe(3.3).fill().toString();
Buffer.alloc(3.3).fill().toString();
assert.strictEqual(Buffer.allocUnsafe(NaN).length, 0);
assert.strictEqual(Buffer.allocUnsafe(3.3).length, 3);
assert.strictEqual(Buffer.from({length: 3.3}).length, 3);
assert.strictEqual(Buffer.from({length: 'BAM'}).length, 0);
assert.strictEqual(Buffer.from({ length: 3.3 }).length, 3);
assert.strictEqual(Buffer.from({ length: 'BAM' }).length, 0);
// Make sure that strings are not coerced to numbers.
assert.strictEqual(Buffer.from('99').length, 2);
@ -977,7 +977,7 @@ assert.throws(() => {
const b = Buffer.alloc(1);
a.copy(b, 0, 0x100000000, 0x100000001);
}, common.expectsError(
{code: undefined, type: RangeError, message: 'Index out of range'}));
{ code: undefined, type: RangeError, message: 'Index out of range' }));
// Unpooled buffer (replaces SlowBuffer)
{

4
test/parallel/test-buffer-compare-offset.js

@ -49,7 +49,7 @@ assert.strictEqual(-1, a.compare(b, 0, 7, 4, 6));
assert.strictEqual(1, a.compare(b, 0, null));
// coerces to targetEnd == 5
assert.strictEqual(-1, a.compare(b, 0, {valueOf: () => 5}));
assert.strictEqual(-1, a.compare(b, 0, { valueOf: () => 5 }));
// zero length target
assert.strictEqual(1, a.compare(b, Infinity, -Infinity));
@ -57,7 +57,7 @@ assert.strictEqual(1, a.compare(b, Infinity, -Infinity));
// zero length target because default for targetEnd <= targetSource
assert.strictEqual(1, a.compare(b, '0xff'));
const oor = common.expectsError({code: 'ERR_INDEX_OUT_OF_RANGE'}, 7);
const oor = common.expectsError({ code: 'ERR_INDEX_OUT_OF_RANGE' }, 7);
assert.throws(() => a.compare(b, 0, 100, 0), oor);
assert.throws(() => a.compare(b, 0, 1, 0, 100), oor);

22
test/parallel/test-buffer-fill.js

@ -194,16 +194,16 @@ deepStrictEqualValues(genBuffer(4, [hexBufFill, 1, -1]), [0, 0, 0, 0]);
// Check exceptions
assert.throws(
() => buf1.fill(0, -1),
common.expectsError({code: 'ERR_INDEX_OUT_OF_RANGE'}));
common.expectsError({ code: 'ERR_INDEX_OUT_OF_RANGE' }));
assert.throws(
() => buf1.fill(0, 0, buf1.length + 1),
common.expectsError({code: 'ERR_INDEX_OUT_OF_RANGE'}));
common.expectsError({ code: 'ERR_INDEX_OUT_OF_RANGE' }));
assert.throws(
() => buf1.fill('', -1),
common.expectsError({code: 'ERR_INDEX_OUT_OF_RANGE'}));
common.expectsError({ code: 'ERR_INDEX_OUT_OF_RANGE' }));
assert.throws(
() => buf1.fill('', 0, buf1.length + 1),
common.expectsError({code: 'ERR_INDEX_OUT_OF_RANGE'}));
common.expectsError({ code: 'ERR_INDEX_OUT_OF_RANGE' }));
assert.throws(
() => buf1.fill('a', 0, buf1.length, 'node rocks!'),
common.expectsError({
@ -301,10 +301,10 @@ function testBufs(string, offset, length, encoding) {
// Make sure these throw.
assert.throws(
() => Buffer.allocUnsafe(8).fill('a', -1),
common.expectsError({code: 'ERR_INDEX_OUT_OF_RANGE'}));
common.expectsError({ code: 'ERR_INDEX_OUT_OF_RANGE' }));
assert.throws(
() => Buffer.allocUnsafe(8).fill('a', 0, 9),
common.expectsError({code: 'ERR_INDEX_OUT_OF_RANGE'}));
common.expectsError({ code: 'ERR_INDEX_OUT_OF_RANGE' }));
// Make sure this doesn't hang indefinitely.
Buffer.allocUnsafe(8).fill('');
@ -371,7 +371,7 @@ Buffer.alloc(8, '');
};
Buffer.alloc(1).fill(Buffer.alloc(1), start, 1);
}, common.expectsError(
{code: undefined, type: RangeError, message: 'Index out of range'}));
{ code: undefined, type: RangeError, message: 'Index out of range' }));
// Make sure -1 is making it to Buffer::Fill().
assert.ok(elseWasLast,
'internal API changed, -1 no longer in correct location');
@ -382,7 +382,7 @@ Buffer.alloc(8, '');
assert.throws(() => {
process.binding('buffer').fill(Buffer.alloc(1), 1, -1, 0, 1);
}, common.expectsError(
{code: undefined, type: RangeError, message: 'Index out of range'}));
{ code: undefined, type: RangeError, message: 'Index out of range' }));
// Make sure "end" is properly checked, even if it's magically mangled using
// Symbol.toPrimitive.
@ -406,7 +406,7 @@ assert.throws(() => {
};
Buffer.alloc(1).fill(Buffer.alloc(1), 0, end);
}, common.expectsError(
{code: undefined, type: RangeError, message: 'Index out of range'}));
{ code: undefined, type: RangeError, message: 'Index out of range' }));
// Make sure -1 is making it to Buffer::Fill().
assert.ok(elseWasLast,
'internal API changed, -1 no longer in correct location');
@ -417,7 +417,7 @@ assert.throws(() => {
assert.throws(() => {
process.binding('buffer').fill(Buffer.alloc(1), 1, 1, -2, 1);
}, common.expectsError(
{ code: undefined, type: RangeError, message: 'Index out of range'}));
{ code: undefined, type: RangeError, message: 'Index out of range' }));
// Test that bypassing 'length' won't cause an abort.
assert.throws(() => {
@ -428,7 +428,7 @@ assert.throws(() => {
});
buf.fill('');
}, common.expectsError(
{ code: undefined, type: RangeError, message: 'Index out of range'}));
{ code: undefined, type: RangeError, message: 'Index out of range' }));
assert.deepStrictEqual(
Buffer.allocUnsafeSlow(16).fill('ab', 'utf16le'),

2
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);
[

2
test/parallel/test-buffer-read.js

@ -10,7 +10,7 @@ function read(buff, funx, args, expected) {
assert.strictEqual(buff[funx](...args), expected);
assert.throws(
() => buff[funx](-1),
common.expectsError({code: 'ERR_INDEX_OUT_OF_RANGE'})
common.expectsError({ code: 'ERR_INDEX_OUT_OF_RANGE' })
);
assert.doesNotThrow(

2
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 }));

4
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(() => {

19
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);

4
test/parallel/test-child-process-env.js

@ -34,9 +34,9 @@ Object.setPrototypeOf(env, {
let child;
if (common.isWindows) {
child = spawn('cmd.exe', ['/c', 'set'], {env: env});
child = spawn('cmd.exe', ['/c', 'set'], { env: env });
} else {
child = spawn('/usr/bin/env', [], {env: env});
child = spawn('/usr/bin/env', [], { env: env });
}

2
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));
}));

4
test/parallel/test-child-process-exec-maxBuffer.js

@ -32,11 +32,11 @@ const unicode = '中文测试'; // length = 4, byte length = 12
{
const cmd = `"${process.execPath}" -e "console.log('${unicode}');"`;
cp.exec(cmd, {maxBuffer: 10}, checkFactory('stdout'));
cp.exec(cmd, { maxBuffer: 10 }, checkFactory('stdout'));
}
{
const cmd = `"${process.execPath}" -e "console.('${unicode}');"`;
cp.exec(cmd, {maxBuffer: 10}, checkFactory('stderr'));
cp.exec(cmd, { maxBuffer: 10 }, checkFactory('stderr'));
}

2
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');

14
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');

2
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 = '';

8
test/parallel/test-child-process-fork-stdio-string-variant.js

@ -10,16 +10,16 @@ const fork = require('child_process').fork;
const childScript = `${common.fixturesDir}/child-process-spawn-node`;
const errorRegexp = /^TypeError: Incorrect value of stdio option:/;
const malFormedOpts = {stdio: '33'};
const payload = {hello: 'world'};
const malFormedOpts = { stdio: '33' };
const payload = { hello: 'world' };
assert.throws(() => fork(childScript, malFormedOpts), errorRegexp);
function test(stringVariant) {
const child = fork(childScript, {stdio: stringVariant});
const child = fork(childScript, { stdio: stringVariant });
child.on('message', common.mustCall((message) => {
assert.deepStrictEqual(message, {foo: 'bar'});
assert.deepStrictEqual(message, { foo: 'bar' });
}));
child.send(payload);

2
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 = '';

4
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

2
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);
}));
});

2
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;

8
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;

2
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');

4
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
});

2
test/parallel/test-child-process-spawnsync-kill-signal.js

@ -20,7 +20,7 @@ if (process.argv[2] === 'child') {
}
const child = cp.spawnSync(process.execPath,
[__filename, 'child'],
{killSignal, timeout: 100});
{ killSignal, timeout: 100 });
if (beforeSpawn)
internalCp.spawnSync = oldSpawnSync;
assert.strictEqual(child.status, null);

8
test/parallel/test-child-process-spawnsync-shell.js

@ -7,7 +7,7 @@ const internalCp = require('internal/child_process');
const oldSpawnSync = internalCp.spawnSync;
// Verify that a shell is, in fact, executed
const doesNotExist = cp.spawnSync('does-not-exist', {shell: true});
const doesNotExist = cp.spawnSync('does-not-exist', { shell: true });
assert.notStrictEqual(doesNotExist.file, 'does-not-exist');
assert.strictEqual(doesNotExist.error, undefined);
@ -24,20 +24,20 @@ internalCp.spawnSync = common.mustCall(function(opts) {
'echo foo');
return oldSpawnSync(opts);
});
const echo = cp.spawnSync('echo', ['foo'], {shell: true});
const echo = cp.spawnSync('echo', ['foo'], { shell: true });
internalCp.spawnSync = oldSpawnSync;
assert.strictEqual(echo.stdout.toString().trim(), 'foo');
// Verify that shell features can be used
const cmd = 'echo bar | cat';
const command = cp.spawnSync(cmd, {shell: true});
const command = cp.spawnSync(cmd, { shell: true });
assert.strictEqual(command.stdout.toString().trim(), 'bar');
// Verify that the environment is properly inherited
const env = cp.spawnSync(`"${process.execPath}" -pe process.env.BAZ`, {
env: Object.assign({}, process.env, {BAZ: 'buzz'}),
env: Object.assign({}, process.env, { BAZ: 'buzz' }),
shell: true
});

2
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);

6
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([

12
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 }));

4
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);
}

4
test/parallel/test-child-process-validate-stdio.js

@ -6,7 +6,7 @@ const assert = require('assert');
const _validateStdio = require('internal/child_process')._validateStdio;
const expectedError =
common.expectsError({code: 'ERR_INVALID_OPT_VALUE', type: TypeError}, 2);
common.expectsError({ code: 'ERR_INVALID_OPT_VALUE', type: TypeError }, 2);
// should throw if string and not ignore, pipe, or inherit
assert.throws(() => _validateStdio('foo'), expectedError);
@ -27,7 +27,7 @@ assert.throws(() => _validateStdio(600), expectedError);
// should throw if stdio has ipc and sync is true
const stdio2 = ['ipc', 'ipc', 'ipc'];
assert.throws(() => _validateStdio(stdio2, true),
common.expectsError({code: 'ERR_IPC_SYNC_FORK', type: Error}));
common.expectsError({ code: 'ERR_IPC_SYNC_FORK', type: Error }));
{
const stdio3 = [process.stdin, process.stdout, process.stderr];

2
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);

4
test/parallel/test-cli-node-options.js

@ -29,7 +29,7 @@ disallow('--');
disallow('--no_warnings'); // Node options don't allow '_' instead of '-'.
function disallow(opt) {
const options = {env: {NODE_OPTIONS: opt}};
const options = { env: { NODE_OPTIONS: opt } };
exec(process.execPath, options, common.mustCall(function(err) {
const message = err.message.split(/\r?\n/)[1];
const expect = `${process.execPath}: ${opt} is not allowed in NODE_OPTIONS`;
@ -71,7 +71,7 @@ function expect(opt, want) {
const printB = require.resolve('../fixtures/printB.js');
const argv = [printB];
const opts = {
env: {NODE_OPTIONS: opt},
env: { NODE_OPTIONS: opt },
maxBuffer: 1000000000,
};
exec(process.execPath, argv, opts, common.mustCall(function(err, stdout) {

6
test/parallel/test-cli-syntax.js

@ -2,7 +2,7 @@
const common = require('../common');
const assert = require('assert');
const {exec, spawnSync} = require('child_process');
const { exec, spawnSync } = require('child_process');
const path = require('path');
const node = process.execPath;
@ -95,7 +95,7 @@ const notFoundRE = /^Error: Cannot find module/m;
// loop each possible option, `-c` or `--check`
syntaxArgs.forEach(function(args) {
const stdin = 'throw new Error("should not get run");';
const c = spawnSync(node, args, {encoding: 'utf8', input: stdin});
const c = spawnSync(node, args, { encoding: 'utf8', input: stdin });
// no stdout or stderr should be produced
assert.strictEqual(c.stdout, '', 'stdout produced');
@ -108,7 +108,7 @@ syntaxArgs.forEach(function(args) {
// loop each possible option, `-c` or `--check`
syntaxArgs.forEach(function(args) {
const stdin = 'var foo bar;';
const c = spawnSync(node, args, {encoding: 'utf8', input: stdin});
const c = spawnSync(node, args, { encoding: 'utf8', input: stdin });
// stderr should include '[stdin]' as the filename
assert(c.stderr.startsWith('[stdin]'), "stderr doesn't start with [stdin]");

4
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) => {

2
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));

2
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() {

2
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() {

2
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());

4
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();
}));

2
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) => {

2
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) {

2
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();

2
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);

2
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();

2
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() {

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save