Browse Source

test: add common.noop, default for common.mustCall()

Export a new common.noop no-operation function for general use.
Allow using common.mustCall() without a fn argument to simplify
test cases.

Replace various non-op functions throughout tests with common.noop

PR-URL: https://github.com/nodejs/node/pull/12027
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
v6
James M Snell 8 years ago
parent
commit
4f2e372716
  1. 16
      test/README.md
  2. 2
      test/addons/async-hello-world/test.js
  3. 2
      test/addons/heap-profiler/test.js
  4. 16
      test/common.js
  5. 4
      test/debugger/test-debugger-client.js
  6. 4
      test/message/unhandled_promise_trace_warnings.js
  7. 10
      test/parallel/test-assert.js
  8. 22
      test/parallel/test-async-wrap-check-providers.js
  9. 6
      test/parallel/test-async-wrap-disabled-propagate-parent.js
  10. 6
      test/parallel/test-async-wrap-propagate-parent.js
  11. 2
      test/parallel/test-async-wrap-throw-from-callback.js
  12. 6
      test/parallel/test-async-wrap-throw-no-init.js
  13. 4
      test/parallel/test-async-wrap-uid.js
  14. 4
      test/parallel/test-buffer-includes.js
  15. 2
      test/parallel/test-child-process-bad-stdio.js
  16. 2
      test/parallel/test-child-process-disconnect.js
  17. 4
      test/parallel/test-child-process-fork-ref2.js
  18. 4
      test/parallel/test-child-process-kill.js
  19. 6
      test/parallel/test-child-process-send-type-error.js
  20. 4
      test/parallel/test-child-process-spawnsync-kill-signal.js
  21. 21
      test/parallel/test-child-process-spawnsync-validation-errors.js
  22. 4
      test/parallel/test-child-process-stdin.js
  23. 2
      test/parallel/test-cluster-basic.js
  24. 8
      test/parallel/test-cluster-disconnect-leak.js
  25. 4
      test/parallel/test-cluster-eaccess.js
  26. 2
      test/parallel/test-cluster-http-pipe.js
  27. 4
      test/parallel/test-cluster-rr-domain-listen.js
  28. 2
      test/parallel/test-cluster-setup-master-emit.js
  29. 4
      test/parallel/test-cluster-worker-destroy.js
  30. 4
      test/parallel/test-cluster-worker-wait-server-close.js
  31. 2
      test/parallel/test-console-instance.js
  32. 2
      test/parallel/test-crypto-pbkdf2.js
  33. 2
      test/parallel/test-crypto-random.js
  34. 2
      test/parallel/test-debug-brk.js
  35. 6
      test/parallel/test-dgram-bind-shared-ports.js
  36. 2
      test/parallel/test-dgram-close-is-not-callback.js
  37. 4
      test/parallel/test-dgram-close.js
  38. 11
      test/parallel/test-dgram-oob-buffer.js
  39. 2
      test/parallel/test-dgram-send-empty-buffer.js
  40. 4
      test/parallel/test-dgram-udp4.js
  41. 4
      test/parallel/test-dns-lookup.js
  42. 54
      test/parallel/test-dns.js
  43. 6
      test/parallel/test-domain-crypto.js
  44. 2
      test/parallel/test-domain-exit-dispose.js
  45. 2
      test/parallel/test-domain-timers.js
  46. 4
      test/parallel/test-domain.js
  47. 33
      test/parallel/test-event-emitter-check-listener-leaks.js
  48. 6
      test/parallel/test-event-emitter-get-max-listeners.js
  49. 10
      test/parallel/test-event-emitter-listener-count.js
  50. 4
      test/parallel/test-event-emitter-max-listeners-warning-for-null.js
  51. 4
      test/parallel/test-event-emitter-max-listeners-warning-for-symbol.js
  52. 4
      test/parallel/test-event-emitter-max-listeners-warning.js
  53. 2
      test/parallel/test-event-emitter-max-listeners.js
  54. 4
      test/parallel/test-event-emitter-once.js
  55. 32
      test/parallel/test-event-emitter-remove-all-listeners.js
  56. 6
      test/parallel/test-event-emitter-remove-listeners.js
  57. 2
      test/parallel/test-event-emitter-special-event-names.js
  58. 4
      test/parallel/test-event-emitter-subclass.js
  59. 2
      test/parallel/test-event-emitter-symbols.js
  60. 1
      test/parallel/test-events-list.js
  61. 19
      test/parallel/test-fs-assert-encoding-error.js
  62. 14
      test/parallel/test-fs-empty-readStream.js
  63. 2
      test/parallel/test-fs-make-callback.js
  64. 2
      test/parallel/test-fs-mkdir.js
  65. 6
      test/parallel/test-fs-options-immutable.js
  66. 4
      test/parallel/test-fs-read-file-assert-encoding.js
  67. 6
      test/parallel/test-fs-read-stream-double-close.js
  68. 12
      test/parallel/test-fs-read-stream-inherit.js
  69. 10
      test/parallel/test-fs-read-stream.js
  70. 2
      test/parallel/test-fs-read-type.js
  71. 2
      test/parallel/test-fs-watch-stop-async.js
  72. 5
      test/parallel/test-fs-watch-stop-sync.js
  73. 2
      test/parallel/test-fs-watchfile.js
  74. 6
      test/parallel/test-fs-write-stream-double-close.js
  75. 2
      test/parallel/test-fs-write-stream-end.js
  76. 4
      test/parallel/test-global-console-exists.js
  77. 2
      test/parallel/test-handle-wrap-close-abort.js
  78. 4
      test/parallel/test-handle-wrap-isrefed.js
  79. 2
      test/parallel/test-http-abort-client.js
  80. 2
      test/parallel/test-http-client-aborted-event.js
  81. 11
      test/parallel/test-http-client-defaults.js
  82. 2
      test/parallel/test-http-connect-req-res.js
  83. 2
      test/parallel/test-http-connect.js
  84. 2
      test/parallel/test-http-end-throw-socket-handling.js
  85. 5
      test/parallel/test-http-eof-on-connect.js
  86. 5
      test/parallel/test-http-invalidheaderfield.js
  87. 4
      test/parallel/test-http-parser-bad-ref.js
  88. 2
      test/parallel/test-http-pause-resume-one-end.js
  89. 2
      test/parallel/test-http-pipeline-flood.js
  90. 2
      test/parallel/test-http-server-reject-chunked-with-content-length.js
  91. 8
      test/parallel/test-http-set-timeout-server.js
  92. 5
      test/parallel/test-http-upgrade-server.js
  93. 4
      test/parallel/test-https-close.js
  94. 10
      test/parallel/test-https-set-timeout-server.js
  95. 4
      test/parallel/test-https-socket-options.js
  96. 5
      test/parallel/test-instanceof.js
  97. 2
      test/parallel/test-net-connect-options-ipv6.js
  98. 3
      test/parallel/test-net-connect-options-port.js
  99. 2
      test/parallel/test-net-listen-close-server-callback-is-not-function.js
  100. 2
      test/parallel/test-net-listen-error.js

16
test/README.md

@ -324,7 +324,7 @@ Gets IP of localhost
Array of IPV6 hosts.
### mustCall(fn[, expected])
### mustCall([fn][, expected])
* fn [&lt;Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function)
* expected [&lt;Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) default = 1
* return [&lt;Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function)
@ -333,6 +333,8 @@ Returns a function that calls `fn`. If the returned function has not been called
exactly `expected` number of times when the test is complete, then the test will
fail.
If `fn` is not provided, `common.noop` will be used.
### nodeProcessAborted(exitCode, signal)
* `exitCode` [&lt;Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type)
* `signal` [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)
@ -340,6 +342,18 @@ fail.
Returns `true` if the exit code `exitCode` and/or signal name `signal` represent the exit code and/or signal name of a node process that aborted, `false` otherwise.
### noop
A non-op `Function` that can be used for a variety of scenarios.
For instance,
```js
const common = require('../common');
someAsyncAPI('foo', common.mustCall(common.noop));
```
### opensslCli
* return [&lt;Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type)

2
test/addons/async-hello-world/test.js

@ -6,5 +6,5 @@ const binding = require(`./build/${common.buildType}/binding`);
binding(5, common.mustCall(function(err, val) {
assert.strictEqual(err, null);
assert.strictEqual(val, 10);
process.nextTick(common.mustCall(function() {}));
process.nextTick(common.mustCall());
}));

2
test/addons/heap-profiler/test.js

@ -5,7 +5,7 @@ const common = require('../../common');
const binding = require(`./build/${common.buildType}/binding`);
// Create an AsyncWrap object.
const timer = setTimeout(function() {}, 1);
const timer = setTimeout(common.noop, 1);
timer.unref();
// Stress-test the heap profiler.

16
test/common.js

@ -35,6 +35,9 @@ const execSync = require('child_process').execSync;
const testRoot = process.env.NODE_TEST_DIR ?
fs.realpathSync(process.env.NODE_TEST_DIR) : __dirname;
const noop = () => {};
exports.noop = noop;
exports.fixturesDir = path.join(__dirname, 'fixtures');
exports.tmpDirName = 'tmp';
// PORT should match the definition in test/testpy/__init__.py.
@ -429,6 +432,13 @@ function runCallChecks(exitCode) {
exports.mustCall = function(fn, expected) {
if (typeof fn === 'number') {
expected = fn;
fn = noop;
} else if (fn === undefined) {
fn = noop;
}
if (expected === undefined)
expected = 1;
else if (typeof expected !== 'number')
@ -525,9 +535,9 @@ util.inherits(ArrayStream, stream.Stream);
exports.ArrayStream = ArrayStream;
ArrayStream.prototype.readable = true;
ArrayStream.prototype.writable = true;
ArrayStream.prototype.pause = function() {};
ArrayStream.prototype.resume = function() {};
ArrayStream.prototype.write = function() {};
ArrayStream.prototype.pause = noop;
ArrayStream.prototype.resume = noop;
ArrayStream.prototype.write = noop;
// Returns true if the exit code "exitCode" and/or signal name "signal"
// represent the exit code and/or signal name of a node process that aborted,

4
test/debugger/test-debugger-client.js

@ -150,7 +150,7 @@ addTest(function(client, done) {
let connectCount = 0;
const script = 'setTimeout(function() { console.log("blah"); });' +
'setInterval(function() {}, 1000000);';
'setInterval(common.noop, 1000000);';
let nodeProcess;
@ -193,7 +193,7 @@ function doTest(cb, done) {
console.error('>>> connecting...');
c.connect(debug.port);
c.on('break', function() {
c.reqContinue(function() {});
c.reqContinue(common.noop);
});
c.on('ready', function() {
connectCount++;

4
test/message/unhandled_promise_trace_warnings.js

@ -1,5 +1,5 @@
// Flags: --trace-warnings
'use strict';
require('../common');
const common = require('../common');
const p = Promise.reject(new Error('This was rejected'));
setImmediate(() => p.catch(() => {}));
setImmediate(() => p.catch(common.noop));

10
test/parallel/test-assert.js

@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');
const a = require('assert');
@ -505,22 +505,22 @@ a.throws(makeBlock(a.deepEqual, args, []));
// check messages from assert.throws()
{
assert.throws(
() => { a.throws(() => {}); },
() => { a.throws(common.noop); },
/^AssertionError: Missing expected exception\.$/
);
assert.throws(
() => { a.throws(() => {}, TypeError); },
() => { a.throws(common.noop, TypeError); },
/^AssertionError: Missing expected exception \(TypeError\)\.$/
);
assert.throws(
() => { a.throws(() => {}, 'fhqwhgads'); },
() => { a.throws(common.noop, 'fhqwhgads'); },
/^AssertionError: Missing expected exception: fhqwhgads$/
);
assert.throws(
() => { a.throws(() => {}, TypeError, 'fhqwhgads'); },
() => { a.throws(common.noop, TypeError, 'fhqwhgads'); },
/^AssertionError: Missing expected exception \(TypeError\): fhqwhgads$/
);
}

22
test/parallel/test-async-wrap-check-providers.js

@ -39,35 +39,33 @@ function init(id, provider) {
keyList = keyList.filter((e) => e !== pkeys[provider]);
}
function noop() { }
async_wrap.setupHooks({ init });
async_wrap.enable();
setTimeout(function() { }, 1);
setTimeout(common.noop, 1);
fs.stat(__filename, noop);
fs.stat(__filename, common.noop);
if (!common.isAix) {
// fs-watch currently needs special configuration on AIX and we
// want to improve under https://github.com/nodejs/node/issues/5085.
// strip out fs watch related parts for now
fs.watchFile(__filename, noop);
fs.watchFile(__filename, common.noop);
fs.unwatchFile(__filename);
fs.watch(__filename).close();
}
dns.lookup('localhost', noop);
dns.lookupService('::', 0, noop);
dns.resolve('localhost', noop);
dns.lookup('localhost', common.noop);
dns.lookupService('::', 0, common.noop);
dns.resolve('localhost', common.noop);
new StreamWrap(new net.Socket());
new (process.binding('tty_wrap').TTY)();
crypto.randomBytes(1, noop);
crypto.randomBytes(1, common.noop);
common.refreshTmpDir();
@ -75,14 +73,14 @@ net.createServer(function(c) {
c.end();
this.close();
}).listen(common.PIPE, function() {
net.connect(common.PIPE, noop);
net.connect(common.PIPE, common.noop);
});
net.createServer(function(c) {
c.end();
this.close(checkTLS);
}).listen(0, function() {
net.connect(this.address().port, noop);
net.connect(this.address().port, common.noop);
});
dgram.createSocket('udp4').bind(0, function() {
@ -99,7 +97,7 @@ function checkTLS() {
key: fs.readFileSync(common.fixturesDir + '/keys/ec-key.pem'),
cert: fs.readFileSync(common.fixturesDir + '/keys/ec-cert.pem')
};
const server = tls.createServer(options, noop)
const server = tls.createServer(options, common.noop)
.listen(0, function() {
const connectOpts = { rejectUnauthorized: false };
tls.connect(this.address().port, connectOpts, function() {

6
test/parallel/test-async-wrap-disabled-propagate-parent.js

@ -1,6 +1,6 @@
'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');
const net = require('net');
const async_wrap = process.binding('async_wrap');
@ -28,8 +28,6 @@ function init(uid, type, parentUid, parentHandle) {
}
}
function noop() { }
async_wrap.setupHooks({ init });
async_wrap.enable();
@ -41,7 +39,7 @@ const server = net.createServer(function(c) {
this.close();
});
}).listen(0, function() {
net.connect(this.address().port, noop);
net.connect(this.address().port, common.noop);
});
async_wrap.disable();

6
test/parallel/test-async-wrap-propagate-parent.js

@ -1,6 +1,6 @@
'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');
const net = require('net');
const async_wrap = process.binding('async_wrap');
@ -28,8 +28,6 @@ function init(uid, type, parentUid, parentHandle) {
}
}
function noop() { }
async_wrap.setupHooks({ init });
async_wrap.enable();
@ -41,7 +39,7 @@ const server = net.createServer(function(c) {
this.close();
});
}).listen(0, function() {
net.connect(this.address().port, noop);
net.connect(this.address().port, common.noop);
});

2
test/parallel/test-async-wrap-throw-from-callback.js

@ -43,7 +43,7 @@ if (typeof process.argv[2] === 'string') {
d.on('error', common.mustNotCall());
d.run(() => {
// Using randomBytes because timers are not yet supported.
crypto.randomBytes(0, () => { });
crypto.randomBytes(0, common.noop);
});
} else {

6
test/parallel/test-async-wrap-throw-no-init.js

@ -1,6 +1,6 @@
'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');
const async_wrap = process.binding('async_wrap');
@ -17,9 +17,9 @@ assert.throws(function() {
}, /init callback is not assigned to a function/);
// Should not throw
async_wrap.setupHooks({ init: () => {} });
async_wrap.setupHooks({ init: common.noop });
async_wrap.enable();
assert.throws(function() {
async_wrap.setupHooks(() => {});
async_wrap.setupHooks(common.noop);
}, /hooks should not be set while also enabled/);

4
test/parallel/test-async-wrap-uid.js

@ -1,6 +1,6 @@
'use strict';
require('../common');
const common = require('../common');
const fs = require('fs');
const assert = require('assert');
const async_wrap = process.binding('async_wrap');
@ -8,7 +8,7 @@ const async_wrap = process.binding('async_wrap');
// Give the event loop time to clear out the final uv_close().
let si_cntr = 3;
process.on('beforeExit', () => {
if (--si_cntr > 0) setImmediate(() => {});
if (--si_cntr > 0) setImmediate(common.noop);
});
const storage = new Map();

4
test/parallel/test-buffer-includes.js

@ -1,5 +1,5 @@
'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');
const Buffer = require('buffer').Buffer;
@ -278,7 +278,7 @@ for (let lengthIndex = 0; lengthIndex < lengths.length; lengthIndex++) {
const expectedError =
/^TypeError: "val" argument must be string, number, Buffer or Uint8Array$/;
assert.throws(() => {
b.includes(() => {});
b.includes(common.noop);
}, expectedError);
assert.throws(() => {
b.includes({});

2
test/parallel/test-child-process-bad-stdio.js

@ -5,7 +5,7 @@ const assert = require('assert');
const cp = require('child_process');
if (process.argv[2] === 'child') {
setTimeout(() => {}, common.platformTimeout(100));
setTimeout(common.noop, common.platformTimeout(100));
return;
}

2
test/parallel/test-child-process-disconnect.js

@ -78,7 +78,7 @@ if (process.argv[2] === 'child') {
}));
// the process should also self terminate without using signals
child.on('exit', common.mustCall(function() {}));
child.on('exit', common.mustCall());
// when child is listening
child.on('message', function(obj) {

4
test/parallel/test-child-process-fork-ref2.js

@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
'use strict';
require('../common');
const common = require('../common');
const fork = require('child_process').fork;
if (process.argv[2] === 'child') {
@ -29,7 +29,7 @@ if (process.argv[2] === 'child') {
setTimeout(function() {
console.log('child -> will this keep it alive?');
process.on('message', function() { });
process.on('message', common.noop);
}, 400);
} else {

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

@ -25,9 +25,9 @@ const assert = require('assert');
const spawn = require('child_process').spawn;
const cat = spawn(common.isWindows ? 'cmd' : 'cat');
cat.stdout.on('end', common.mustCall(function() {}));
cat.stdout.on('end', common.mustCall());
cat.stderr.on('data', common.mustNotCall());
cat.stderr.on('end', common.mustCall(function() {}));
cat.stderr.on('end', common.mustCall());
cat.on('exit', common.mustCall(function(code, signal) {
assert.strictEqual(code, null);

6
test/parallel/test-child-process-send-type-error.js

@ -1,10 +1,8 @@
'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');
const cp = require('child_process');
function noop() {}
function fail(proc, args) {
assert.throws(() => {
proc.send.apply(proc, args);
@ -22,4 +20,4 @@ fail(target, ['msg', null, 'foo']);
fail(target, ['msg', null, 0]);
fail(target, ['msg', null, NaN]);
fail(target, ['msg', null, 1]);
fail(target, ['msg', null, null, noop]);
fail(target, ['msg', null, null, common.noop]);

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

@ -1,10 +1,10 @@
'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');
const cp = require('child_process');
if (process.argv[2] === 'child') {
setInterval(() => {}, 1000);
setInterval(common.noop, 1000);
} else {
const { SIGKILL } = process.binding('constants').os.signals;

21
test/parallel/test-child-process-spawnsync-validation-errors.js

@ -2,7 +2,6 @@
const common = require('../common');
const assert = require('assert');
const spawnSync = require('child_process').spawnSync;
const noop = function() {};
function pass(option, value) {
// Run the command with the specified option. Since it's not a real command,
@ -31,7 +30,7 @@ function fail(option, value, message) {
fail('cwd', false, err);
fail('cwd', [], err);
fail('cwd', {}, err);
fail('cwd', noop, err);
fail('cwd', common.noop, err);
}
{
@ -47,7 +46,7 @@ function fail(option, value, message) {
fail('detached', __dirname, err);
fail('detached', [], err);
fail('detached', {}, err);
fail('detached', noop, err);
fail('detached', common.noop, err);
}
if (!common.isWindows) {
@ -64,7 +63,7 @@ if (!common.isWindows) {
fail('uid', false, err);
fail('uid', [], err);
fail('uid', {}, err);
fail('uid', noop, err);
fail('uid', common.noop, err);
fail('uid', NaN, err);
fail('uid', Infinity, err);
fail('uid', 3.1, err);
@ -85,7 +84,7 @@ if (!common.isWindows) {
fail('gid', false, err);
fail('gid', [], err);
fail('gid', {}, err);
fail('gid', noop, err);
fail('gid', common.noop, err);
fail('gid', NaN, err);
fail('gid', Infinity, err);
fail('gid', 3.1, err);
@ -105,7 +104,7 @@ if (!common.isWindows) {
fail('shell', 1, err);
fail('shell', [], err);
fail('shell', {}, err);
fail('shell', noop, err);
fail('shell', common.noop, err);
}
{
@ -121,7 +120,7 @@ if (!common.isWindows) {
fail('argv0', false, err);
fail('argv0', [], err);
fail('argv0', {}, err);
fail('argv0', noop, err);
fail('argv0', common.noop, err);
}
{
@ -137,7 +136,7 @@ if (!common.isWindows) {
fail('windowsVerbatimArguments', __dirname, err);
fail('windowsVerbatimArguments', [], err);
fail('windowsVerbatimArguments', {}, err);
fail('windowsVerbatimArguments', noop, err);
fail('windowsVerbatimArguments', common.noop, err);
}
{
@ -154,7 +153,7 @@ if (!common.isWindows) {
fail('timeout', __dirname, err);
fail('timeout', [], err);
fail('timeout', {}, err);
fail('timeout', noop, err);
fail('timeout', common.noop, err);
fail('timeout', NaN, err);
fail('timeout', Infinity, err);
fail('timeout', 3.1, err);
@ -179,7 +178,7 @@ if (!common.isWindows) {
fail('maxBuffer', __dirname, err);
fail('maxBuffer', [], err);
fail('maxBuffer', {}, err);
fail('maxBuffer', noop, err);
fail('maxBuffer', common.noop, err);
}
{
@ -198,5 +197,5 @@ if (!common.isWindows) {
fail('killSignal', false, typeErr);
fail('killSignal', [], typeErr);
fail('killSignal', {}, typeErr);
fail('killSignal', noop, typeErr);
fail('killSignal', common.noop, typeErr);
}

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

@ -43,11 +43,11 @@ cat.stdout.on('data', function(chunk) {
response += chunk;
});
cat.stdout.on('end', common.mustCall(function() {}));
cat.stdout.on('end', common.mustCall());
cat.stderr.on('data', common.mustNotCall());
cat.stderr.on('end', common.mustCall(function() {}));
cat.stderr.on('end', common.mustCall());
cat.on('exit', common.mustCall(function(status) {
assert.strictEqual(0, status);

2
test/parallel/test-cluster-basic.js

@ -103,7 +103,7 @@ if (cluster.isWorker) {
}));
//Kill process when worker is killed
cluster.on('exit', common.mustCall(() => {}));
cluster.on('exit', common.mustCall());
//Create worker
const worker = cluster.fork();

8
test/parallel/test-cluster-disconnect-leak.js

@ -6,19 +6,17 @@ const common = require('../common');
const net = require('net');
const cluster = require('cluster');
const noop = () => {};
cluster.schedulingPolicy = cluster.SCHED_NONE;
if (cluster.isMaster) {
const worker = cluster.fork();
// This is the important part of the test: Confirm that `disconnect` fires.
worker.on('disconnect', common.mustCall(noop));
worker.on('disconnect', common.mustCall());
// These are just some extra stuff we're checking for good measure...
worker.on('exit', common.mustCall(noop));
cluster.on('exit', common.mustCall(noop));
worker.on('exit', common.mustCall());
cluster.on('exit', common.mustCall());
cluster.disconnect();
return;

4
test/parallel/test-cluster-eaccess.js

@ -35,10 +35,10 @@ if (cluster.isMaster) {
const worker = cluster.fork();
// makes sure master is able to fork the worker
cluster.on('fork', common.mustCall(function() {}));
cluster.on('fork', common.mustCall());
// makes sure the worker is ready
worker.on('online', common.mustCall(function() {}));
worker.on('online', common.mustCall());
worker.on('message', common.mustCall(function(err) {
// disconnect first, so that we will not leave zombies

2
test/parallel/test-cluster-http-pipe.js

@ -38,7 +38,7 @@ if (cluster.isMaster) {
worker.on('message', common.mustCall((msg) => {
assert.strictEqual(msg, 'DONE');
}));
worker.on('exit', common.mustCall(() => {}));
worker.on('exit', common.mustCall());
return;
}

4
test/parallel/test-cluster-rr-domain-listen.js

@ -29,10 +29,10 @@ const domain = require('domain');
if (cluster.isWorker) {
const d = domain.create();
d.run(function() { });
d.run(common.noop);
const http = require('http');
http.Server(function() { }).listen(common.PORT, '127.0.0.1');
http.Server(common.noop).listen(common.PORT, '127.0.0.1');
} else if (cluster.isMaster) {

2
test/parallel/test-cluster-setup-master-emit.js

@ -43,5 +43,5 @@ function emitAndCatch2(next) {
}
emitAndCatch(common.mustCall(function() {
emitAndCatch2(common.mustCall(function() {}));
emitAndCatch2(common.mustCall());
}));

4
test/parallel/test-cluster-worker-destroy.js

@ -38,8 +38,8 @@ if (cluster.isMaster) {
worker2 = cluster.fork();
[worker1, worker2].forEach(function(worker) {
worker.on('disconnect', common.mustCall(function() {}));
worker.on('exit', common.mustCall(function() {}));
worker.on('disconnect', common.mustCall());
worker.on('exit', common.mustCall());
});
} else {
if (cluster.worker.id === 1) {

4
test/parallel/test-cluster-worker-wait-server-close.js

@ -11,7 +11,7 @@ if (cluster.isWorker) {
const server = net.createServer(function(socket) {
// Wait for any data, then close connection
socket.write('.');
socket.on('data', function discard() {});
socket.on('data', common.noop);
}).listen(common.PORT, common.localhostIPv4);
server.once('close', function() {
@ -20,7 +20,7 @@ if (cluster.isWorker) {
// Although not typical, the worker process can exit before the disconnect
// event fires. Use this to keep the process open until the event has fired.
const keepOpen = setInterval(function() {}, 9999);
const keepOpen = setInterval(common.noop, 9999);
// Check worker events and properties
process.once('disconnect', function() {

2
test/parallel/test-console-instance.js

@ -43,7 +43,7 @@ assert.throws(() => {
// Console constructor should throw if stderr exists but is not writable
assert.throws(() => {
out.write = () => {};
out.write = common.noop;
err.write = undefined;
new Console(out, err);
}, /^TypeError: Console expects writable stream instances$/);

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

@ -98,7 +98,7 @@ assert.doesNotThrow(() => {
});
assert.throws(() => {
crypto.pbkdf2('password', 'salt', 8, 8, function() {});
crypto.pbkdf2('password', 'salt', 8, 8, common.noop);
}, /^TypeError: The "digest" argument is required and must not be undefined$/);
assert.throws(() => {

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

@ -38,7 +38,7 @@ const expectedErrorRegexp = /^TypeError: size must be a number >= 0$/;
[crypto.randomBytes, crypto.pseudoRandomBytes].forEach(function(f) {
[-1, undefined, null, false, true, {}, []].forEach(function(value) {
assert.throws(function() { f(value); }, expectedErrorRegexp);
assert.throws(function() { f(value, function() {}); }, expectedErrorRegexp);
assert.throws(function() { f(value, common.noop); }, expectedErrorRegexp);
});
[0, 1, 2, 4, 16, 256, 1024].forEach(function(len) {

2
test/parallel/test-debug-brk.js

@ -3,7 +3,7 @@
const common = require('../common');
const spawn = require('child_process').spawn;
let run = () => {};
let run = common.noop;
function test(extraArgs, stdoutPattern) {
const next = run;
run = () => {

6
test/parallel/test-dgram-bind-shared-ports.js

@ -25,8 +25,6 @@ const assert = require('assert');
const cluster = require('cluster');
const dgram = require('dgram');
function noop() { }
if (cluster.isMaster) {
const worker1 = cluster.fork();
@ -51,8 +49,8 @@ if (cluster.isMaster) {
});
});
} else {
const socket1 = dgram.createSocket('udp4', noop);
const socket2 = dgram.createSocket('udp4', noop);
const socket1 = dgram.createSocket('udp4', common.noop);
const socket2 = dgram.createSocket('udp4', common.noop);
socket1.on('error', (err) => {
// no errors expected

2
test/parallel/test-dgram-close-is-not-callback.js

@ -11,4 +11,4 @@ socket.send(buf, 0, buf.length, common.PORT, 'localhost');
// if close callback is not function, ignore the argument.
socket.close('bad argument');
socket.on('close', common.mustCall(function() {}));
socket.on('close', common.mustCall());

4
test/parallel/test-dgram-close.js

@ -33,8 +33,8 @@ let socket = dgram.createSocket('udp4');
const handle = socket._handle;
socket.send(buf, 0, buf.length, common.PORT, 'localhost');
assert.strictEqual(socket.close(common.mustCall(function() {})), socket);
socket.on('close', common.mustCall(function() {}));
assert.strictEqual(socket.close(common.mustCall()), socket);
socket.on('close', common.mustCall());
socket = null;
// Verify that accessing handle after closure doesn't throw

11
test/parallel/test-dgram-oob-buffer.js

@ -30,12 +30,11 @@ const dgram = require('dgram');
const socket = dgram.createSocket('udp4');
const buf = Buffer.from([1, 2, 3, 4]);
function ok() {}
socket.send(buf, 0, 0, common.PORT, '127.0.0.1', ok); // useful? no
socket.send(buf, 0, 4, common.PORT, '127.0.0.1', ok);
socket.send(buf, 1, 3, common.PORT, '127.0.0.1', ok);
socket.send(buf, 3, 1, common.PORT, '127.0.0.1', ok);
socket.send(buf, 0, 0, common.PORT, '127.0.0.1', common.noop); // useful? no
socket.send(buf, 0, 4, common.PORT, '127.0.0.1', common.noop);
socket.send(buf, 1, 3, common.PORT, '127.0.0.1', common.noop);
socket.send(buf, 3, 1, common.PORT, '127.0.0.1', common.noop);
// Since length of zero means nothing, don't error despite OOB.
socket.send(buf, 4, 0, common.PORT, '127.0.0.1', ok);
socket.send(buf, 4, 0, common.PORT, '127.0.0.1', common.noop);
socket.close();

2
test/parallel/test-dgram-send-empty-buffer.js

@ -43,6 +43,6 @@ client.bind(0, common.mustCall(function() {
const buf = Buffer.alloc(0);
const interval = setInterval(function() {
client.send(buf, 0, 0, port, '127.0.0.1', common.mustCall(function() {}));
client.send(buf, 0, 0, port, '127.0.0.1', common.mustCall());
}, 10);
}));

4
test/parallel/test-dgram-udp4.js

@ -46,7 +46,7 @@ server.on('listening', common.mustCall(() => {
message_to_send.length,
port,
'localhost');
client.on('close', common.mustCall(() => {}));
client.on('close', common.mustCall());
}));
server.on('close', common.mustCall(() => {}));
server.on('close', common.mustCall());
server.bind(0);

4
test/parallel/test-dns-lookup.js

@ -24,7 +24,7 @@ assert.throws(() => {
hints: 100,
family: 0,
all: false
}, () => {});
}, common.noop);
}, /^TypeError: Invalid argument: hints must use valid flags$/);
assert.throws(() => {
@ -32,7 +32,7 @@ assert.throws(() => {
hints: 0,
family: 20,
all: false
}, () => {});
}, common.noop);
}, /^TypeError: Invalid argument: family must be 4 or 6$/);
assert.doesNotThrow(() => {

54
test/parallel/test-dns.js

@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');
const dns = require('dns');
@ -55,8 +55,6 @@ assert.doesNotThrow(() => {
dns.setServers(servers);
});
function noop() {}
const goog = [
'8.8.8.8',
'8.8.4.4',
@ -93,7 +91,7 @@ assert.doesNotThrow(() => dns.setServers([]));
assert.deepStrictEqual(dns.getServers(), []);
assert.throws(() => {
dns.resolve('test.com', [], noop);
dns.resolve('test.com', [], common.noop);
}, function(err) {
return !(err instanceof TypeError);
}, 'Unexpected error');
@ -102,25 +100,25 @@ assert.throws(() => {
const errorReg =
/^TypeError: Invalid arguments: hostname must be a string or falsey$/;
assert.throws(() => dns.lookup({}, noop), errorReg);
assert.throws(() => dns.lookup({}, common.noop), errorReg);
assert.throws(() => dns.lookup([], noop), errorReg);
assert.throws(() => dns.lookup([], common.noop), errorReg);
assert.throws(() => dns.lookup(true, noop), errorReg);
assert.throws(() => dns.lookup(true, common.noop), errorReg);
assert.throws(() => dns.lookup(1, noop), errorReg);
assert.throws(() => dns.lookup(1, common.noop), errorReg);
assert.throws(() => dns.lookup(noop, noop), errorReg);
assert.throws(() => dns.lookup(common.noop, common.noop), errorReg);
assert.doesNotThrow(() => dns.lookup('', noop));
assert.doesNotThrow(() => dns.lookup('', common.noop));
assert.doesNotThrow(() => dns.lookup(null, noop));
assert.doesNotThrow(() => dns.lookup(null, common.noop));
assert.doesNotThrow(() => dns.lookup(undefined, noop));
assert.doesNotThrow(() => dns.lookup(undefined, common.noop));
assert.doesNotThrow(() => dns.lookup(0, noop));
assert.doesNotThrow(() => dns.lookup(0, common.noop));
assert.doesNotThrow(() => dns.lookup(NaN, noop));
assert.doesNotThrow(() => dns.lookup(NaN, common.noop));
/*
* Make sure that dns.lookup throws if hints does not represent a valid flag.
@ -133,7 +131,7 @@ assert.doesNotThrow(() => dns.lookup(NaN, noop));
*/
assert.throws(() => {
dns.lookup('www.google.com', { hints: (dns.V4MAPPED | dns.ADDRCONFIG) + 1 },
noop);
common.noop);
}, /^TypeError: Invalid argument: hints must use valid flags$/);
assert.throws(() => dns.lookup('www.google.com'),
@ -142,49 +140,49 @@ assert.throws(() => dns.lookup('www.google.com'),
assert.throws(() => dns.lookup('www.google.com', 4),
/^TypeError: Invalid arguments: callback must be passed$/);
assert.doesNotThrow(() => dns.lookup('www.google.com', 6, noop));
assert.doesNotThrow(() => dns.lookup('www.google.com', 6, common.noop));
assert.doesNotThrow(() => dns.lookup('www.google.com', {}, noop));
assert.doesNotThrow(() => dns.lookup('www.google.com', {}, common.noop));
assert.doesNotThrow(() => dns.lookup('', {family: 4, hints: 0}, noop));
assert.doesNotThrow(() => dns.lookup('', {family: 4, hints: 0}, common.noop));
assert.doesNotThrow(() => {
dns.lookup('', {
family: 6,
hints: dns.ADDRCONFIG
}, noop);
}, common.noop);
});
assert.doesNotThrow(() => dns.lookup('', {hints: dns.V4MAPPED}, noop));
assert.doesNotThrow(() => dns.lookup('', {hints: dns.V4MAPPED}, common.noop));
assert.doesNotThrow(() => {
dns.lookup('', {
hints: dns.ADDRCONFIG | dns.V4MAPPED
}, noop);
}, common.noop);
});
assert.throws(() => dns.lookupService('0.0.0.0'),
/^Error: Invalid arguments$/);
assert.throws(() => dns.lookupService('fasdfdsaf', 0, noop),
assert.throws(() => dns.lookupService('fasdfdsaf', 0, common.noop),
/^TypeError: "host" argument needs to be a valid IP address$/);
assert.doesNotThrow(() => dns.lookupService('0.0.0.0', '0', noop));
assert.doesNotThrow(() => dns.lookupService('0.0.0.0', '0', common.noop));
assert.doesNotThrow(() => dns.lookupService('0.0.0.0', 0, noop));
assert.doesNotThrow(() => dns.lookupService('0.0.0.0', 0, common.noop));
assert.throws(() => dns.lookupService('0.0.0.0', null, noop),
assert.throws(() => dns.lookupService('0.0.0.0', null, common.noop),
/^TypeError: "port" should be >= 0 and < 65536, got "null"$/);
assert.throws(
() => dns.lookupService('0.0.0.0', undefined, noop),
() => dns.lookupService('0.0.0.0', undefined, common.noop),
/^TypeError: "port" should be >= 0 and < 65536, got "undefined"$/
);
assert.throws(() => dns.lookupService('0.0.0.0', 65538, noop),
assert.throws(() => dns.lookupService('0.0.0.0', 65538, common.noop),
/^TypeError: "port" should be >= 0 and < 65536, got "65538"$/);
assert.throws(() => dns.lookupService('0.0.0.0', 'test', noop),
assert.throws(() => dns.lookupService('0.0.0.0', 'test', common.noop),
/^TypeError: "port" should be >= 0 and < 65536, got "test"$/);
assert.throws(() => dns.lookupService('0.0.0.0', 80, null),

6
test/parallel/test-domain-crypto.js

@ -37,7 +37,7 @@ global.domain = require('domain');
// should not throw a 'TypeError: undefined is not a function' exception
crypto.randomBytes(8);
crypto.randomBytes(8, function() {});
crypto.randomBytes(8, common.noop);
crypto.pseudoRandomBytes(8);
crypto.pseudoRandomBytes(8, function() {});
crypto.pbkdf2('password', 'salt', 8, 8, 'sha1', function() {});
crypto.pseudoRandomBytes(8, common.noop);
crypto.pbkdf2('password', 'salt', 8, 8, 'sha1', common.noop);

2
test/parallel/test-domain-exit-dispose.js

@ -43,7 +43,7 @@ function err() {
function err2() {
// this timeout should never be called, since the domain gets
// disposed when the error happens.
setTimeout(common.mustCall(() => {}, 0), 1);
setTimeout(common.mustNotCall(), 1);
// this function doesn't exist, and throws an error as a result.
err3(); // eslint-disable-line no-undef

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

@ -51,4 +51,4 @@ immediated.run(function() {
});
});
const timeout = setTimeout(function() {}, 10 * 1000);
const timeout = setTimeout(common.noop, 10 * 1000);

4
test/parallel/test-domain.js

@ -22,7 +22,7 @@
'use strict';
// Simple tests of most basic domain functionality.
require('../common');
const common = require('../common');
const assert = require('assert');
const domain = require('domain');
const events = require('events');
@ -261,7 +261,7 @@ const fst = fs.createReadStream('stream for nonexistent file');
d.add(fst);
expectCaught++;
[42, null, , false, function() {}, 'string'].forEach(function(something) {
[42, null, , false, common.noop, 'string'].forEach(function(something) {
const d = new domain.Domain();
d.run(function() {
process.nextTick(function() {

33
test/parallel/test-event-emitter-check-listener-leaks.js

@ -20,7 +20,8 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');
const events = require('events');
@ -28,40 +29,40 @@ let e = new events.EventEmitter();
// default
for (let i = 0; i < 10; i++) {
e.on('default', function() {});
e.on('default', common.noop);
}
assert.ok(!e._events['default'].hasOwnProperty('warned'));
e.on('default', function() {});
e.on('default', common.noop);
assert.ok(e._events['default'].warned);
// symbol
const symbol = Symbol('symbol');
e.setMaxListeners(1);
e.on(symbol, function() {});
e.on(symbol, common.noop);
assert.ok(!e._events[symbol].hasOwnProperty('warned'));
e.on(symbol, function() {});
e.on(symbol, common.noop);
assert.ok(e._events[symbol].hasOwnProperty('warned'));
// specific
e.setMaxListeners(5);
for (let i = 0; i < 5; i++) {
e.on('specific', function() {});
e.on('specific', common.noop);
}
assert.ok(!e._events['specific'].hasOwnProperty('warned'));
e.on('specific', function() {});
e.on('specific', common.noop);
assert.ok(e._events['specific'].warned);
// only one
e.setMaxListeners(1);
e.on('only one', function() {});
e.on('only one', common.noop);
assert.ok(!e._events['only one'].hasOwnProperty('warned'));
e.on('only one', function() {});
e.on('only one', common.noop);
assert.ok(e._events['only one'].hasOwnProperty('warned'));
// unlimited
e.setMaxListeners(0);
for (let i = 0; i < 1000; i++) {
e.on('unlimited', function() {});
e.on('unlimited', common.noop);
}
assert.ok(!e._events['unlimited'].hasOwnProperty('warned'));
@ -70,26 +71,26 @@ events.EventEmitter.defaultMaxListeners = 42;
e = new events.EventEmitter();
for (let i = 0; i < 42; ++i) {
e.on('fortytwo', function() {});
e.on('fortytwo', common.noop);
}
assert.ok(!e._events['fortytwo'].hasOwnProperty('warned'));
e.on('fortytwo', function() {});
e.on('fortytwo', common.noop);
assert.ok(e._events['fortytwo'].hasOwnProperty('warned'));
delete e._events['fortytwo'].warned;
events.EventEmitter.defaultMaxListeners = 44;
e.on('fortytwo', function() {});
e.on('fortytwo', common.noop);
assert.ok(!e._events['fortytwo'].hasOwnProperty('warned'));
e.on('fortytwo', function() {});
e.on('fortytwo', common.noop);
assert.ok(e._events['fortytwo'].hasOwnProperty('warned'));
// but _maxListeners still has precedence over defaultMaxListeners
events.EventEmitter.defaultMaxListeners = 42;
e = new events.EventEmitter();
e.setMaxListeners(1);
e.on('uno', function() {});
e.on('uno', common.noop);
assert.ok(!e._events['uno'].hasOwnProperty('warned'));
e.on('uno', function() {});
e.on('uno', common.noop);
assert.ok(e._events['uno'].hasOwnProperty('warned'));
// chainable

6
test/parallel/test-event-emitter-get-max-listeners.js

@ -1,5 +1,5 @@
'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');
const EventEmitter = require('events');
@ -15,5 +15,5 @@ assert.strictEqual(emitter.getMaxListeners(), 3);
// https://github.com/nodejs/node/issues/523 - second call should not throw.
const recv = {};
EventEmitter.prototype.on.call(recv, 'event', function() {});
EventEmitter.prototype.on.call(recv, 'event', function() {});
EventEmitter.prototype.on.call(recv, 'event', common.noop);
EventEmitter.prototype.on.call(recv, 'event', common.noop);

10
test/parallel/test-event-emitter-listener-count.js

@ -1,15 +1,15 @@
'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');
const EventEmitter = require('events');
const emitter = new EventEmitter();
emitter.on('foo', function() {});
emitter.on('foo', function() {});
emitter.on('baz', function() {});
emitter.on('foo', common.noop);
emitter.on('foo', common.noop);
emitter.on('baz', common.noop);
// Allow any type
emitter.on(123, function() {});
emitter.on(123, common.noop);
assert.strictEqual(EventEmitter.listenerCount(emitter, 'foo'), 2);
assert.strictEqual(emitter.listenerCount('foo'), 2);

4
test/parallel/test-event-emitter-max-listeners-warning-for-null.js

@ -18,5 +18,5 @@ process.on('warning', common.mustCall((warning) => {
assert.ok(warning.message.includes('2 null listeners added.'));
}));
e.on(null, function() {});
e.on(null, function() {});
e.on(null, common.noop);
e.on(null, common.noop);

4
test/parallel/test-event-emitter-max-listeners-warning-for-symbol.js

@ -20,5 +20,5 @@ process.on('warning', common.mustCall((warning) => {
assert.ok(warning.message.includes('2 Symbol(symbol) listeners added.'));
}));
e.on(symbol, function() {});
e.on(symbol, function() {});
e.on(symbol, common.noop);
e.on(symbol, common.noop);

4
test/parallel/test-event-emitter-max-listeners-warning.js

@ -18,5 +18,5 @@ process.on('warning', common.mustCall((warning) => {
assert.ok(warning.message.includes('2 event-type listeners added.'));
}));
e.on('event-type', function() {});
e.on('event-type', function() {});
e.on('event-type', common.noop);
e.on('event-type', common.noop);

2
test/parallel/test-event-emitter-max-listeners.js

@ -25,7 +25,7 @@ const assert = require('assert');
const events = require('events');
const e = new events.EventEmitter();
e.on('maxListeners', common.mustCall(function() {}));
e.on('maxListeners', common.mustCall());
// Should not corrupt the 'maxListeners' queue.
e.setMaxListeners(42);

4
test/parallel/test-event-emitter-once.js

@ -26,7 +26,7 @@ const EventEmitter = require('events');
const e = new EventEmitter();
e.once('hello', common.mustCall(function(a, b) {}));
e.once('hello', common.mustCall());
e.emit('hello', 'a', 'b');
e.emit('hello', 'a', 'b');
@ -45,7 +45,7 @@ e.once('e', common.mustCall(function() {
e.emit('e');
}));
e.once('e', common.mustCall(function() {}));
e.once('e', common.mustCall());
e.emit('e');

32
test/parallel/test-event-emitter-remove-all-listeners.js

@ -36,28 +36,26 @@ function expect(expected) {
return common.mustCall(listener, expected.length);
}
function listener() {}
{
const ee = new events.EventEmitter();
ee.on('foo', listener);
ee.on('bar', listener);
ee.on('baz', listener);
ee.on('baz', listener);
ee.on('foo', common.noop);
ee.on('bar', common.noop);
ee.on('baz', common.noop);
ee.on('baz', common.noop);
const fooListeners = ee.listeners('foo');
const barListeners = ee.listeners('bar');
const bazListeners = ee.listeners('baz');
ee.on('removeListener', expect(['bar', 'baz', 'baz']));
ee.removeAllListeners('bar');
ee.removeAllListeners('baz');
assert.deepStrictEqual(ee.listeners('foo'), [listener]);
assert.deepStrictEqual(ee.listeners('foo'), [common.noop]);
assert.deepStrictEqual(ee.listeners('bar'), []);
assert.deepStrictEqual(ee.listeners('baz'), []);
// After calling removeAllListeners(),
// the old listeners array should stay unchanged.
assert.deepStrictEqual(fooListeners, [listener]);
assert.deepStrictEqual(barListeners, [listener]);
assert.deepStrictEqual(bazListeners, [listener, listener]);
assert.deepStrictEqual(fooListeners, [common.noop]);
assert.deepStrictEqual(barListeners, [common.noop]);
assert.deepStrictEqual(bazListeners, [common.noop, common.noop]);
// After calling removeAllListeners(),
// new listeners arrays is different from the old.
assert.notStrictEqual(ee.listeners('bar'), barListeners);
@ -66,8 +64,8 @@ function listener() {}
{
const ee = new events.EventEmitter();
ee.on('foo', listener);
ee.on('bar', listener);
ee.on('foo', common.noop);
ee.on('bar', common.noop);
// Expect LIFO order
ee.on('removeListener', expect(['foo', 'bar', 'removeListener']));
ee.on('removeListener', expect(['foo', 'bar']));
@ -78,7 +76,7 @@ function listener() {}
{
const ee = new events.EventEmitter();
ee.on('removeListener', listener);
ee.on('removeListener', common.noop);
// Check for regression where removeAllListeners() throws when
// there exists a 'removeListener' listener, but there exists
// no listeners for the provided event type.
@ -88,12 +86,12 @@ function listener() {}
{
const ee = new events.EventEmitter();
let expectLength = 2;
ee.on('removeListener', function(name, listener) {
ee.on('removeListener', function(name, noop) {
assert.strictEqual(expectLength--, this.listeners('baz').length);
});
ee.on('baz', function() {});
ee.on('baz', function() {});
ee.on('baz', function() {});
ee.on('baz', common.noop);
ee.on('baz', common.noop);
ee.on('baz', common.noop);
assert.strictEqual(ee.listeners('baz').length, expectLength + 1);
ee.removeAllListeners('baz');
assert.strictEqual(ee.listeners('baz').length, 0);

6
test/parallel/test-event-emitter-remove-listeners.js

@ -112,7 +112,7 @@ function listener2() {}
const listener3 = common.mustCall(() => {
ee.removeListener('hello', listener4);
}, 2);
const listener4 = common.mustCall(() => {});
const listener4 = common.mustCall();
ee.on('hello', listener3);
ee.on('hello', listener4);
@ -140,7 +140,7 @@ function listener2() {}
{
const ee = new EventEmitter();
assert.deepStrictEqual(ee, ee.removeListener('foo', () => {}));
assert.deepStrictEqual(ee, ee.removeListener('foo', common.noop));
}
// Verify that the removed listener must be a function
@ -152,7 +152,7 @@ assert.throws(() => {
{
const ee = new EventEmitter();
const listener = () => {};
const listener = common.noop;
ee._events = undefined;
const e = ee.removeListener('foo', listener);
assert.strictEqual(e, ee);

2
test/parallel/test-event-emitter-special-event-names.js

@ -5,7 +5,7 @@ const EventEmitter = require('events');
const assert = require('assert');
const ee = new EventEmitter();
const handler = () => {};
const handler = common.noop;
assert.deepStrictEqual(ee.eventNames(), []);

4
test/parallel/test-event-emitter-subclass.js

@ -34,7 +34,7 @@ function MyEE(cb) {
EventEmitter.call(this);
}
const myee = new MyEE(common.mustCall(function() {}));
const myee = new MyEE(common.mustCall());
util.inherits(ErrorEE, EventEmitter);
@ -62,6 +62,6 @@ MyEE2.prototype = new EventEmitter();
const ee1 = new MyEE2();
const ee2 = new MyEE2();
ee1.on('x', function() {});
ee1.on('x', common.noop);
assert.strictEqual(ee2.listenerCount('x'), 0);

2
test/parallel/test-event-emitter-symbols.js

@ -6,7 +6,7 @@ const assert = require('assert');
const ee = new EventEmitter();
const foo = Symbol('foo');
const listener = common.mustCall(function() {});
const listener = common.mustCall();
ee.on(foo, listener);
assert.deepStrictEqual(ee.listeners(foo), [listener]);

1
test/parallel/test-events-list.js

@ -5,6 +5,7 @@ const EventEmitter = require('events');
const assert = require('assert');
const EE = new EventEmitter();
// Do not use common.noop here, these need to be separate listener functions
const m = () => {};
EE.on('foo', () => {});
assert.deepStrictEqual(['foo'], EE.eventNames());

19
test/parallel/test-fs-assert-encoding-error.js

@ -1,14 +1,13 @@
'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');
const fs = require('fs');
const options = 'test';
const noop = () => {};
const unknownEncodingMessage = /^Error: Unknown encoding: test$/;
assert.throws(() => {
fs.readFile('path', options, noop);
fs.readFile('path', options, common.noop);
}, unknownEncodingMessage);
assert.throws(() => {
@ -16,7 +15,7 @@ assert.throws(() => {
}, unknownEncodingMessage);
assert.throws(() => {
fs.readdir('path', options, noop);
fs.readdir('path', options, common.noop);
}, unknownEncodingMessage);
assert.throws(() => {
@ -24,7 +23,7 @@ assert.throws(() => {
}, unknownEncodingMessage);
assert.throws(() => {
fs.readlink('path', options, noop);
fs.readlink('path', options, common.noop);
}, unknownEncodingMessage);
assert.throws(() => {
@ -32,7 +31,7 @@ assert.throws(() => {
}, unknownEncodingMessage);
assert.throws(() => {
fs.writeFile('path', 'data', options, noop);
fs.writeFile('path', 'data', options, common.noop);
}, unknownEncodingMessage);
assert.throws(() => {
@ -40,7 +39,7 @@ assert.throws(() => {
}, unknownEncodingMessage);
assert.throws(() => {
fs.appendFile('path', 'data', options, noop);
fs.appendFile('path', 'data', options, common.noop);
}, unknownEncodingMessage);
assert.throws(() => {
@ -48,11 +47,11 @@ assert.throws(() => {
}, unknownEncodingMessage);
assert.throws(() => {
fs.watch('path', options, noop);
fs.watch('path', options, common.noop);
}, unknownEncodingMessage);
assert.throws(() => {
fs.realpath('path', options, noop);
fs.realpath('path', options, common.noop);
}, unknownEncodingMessage);
assert.throws(() => {
@ -60,7 +59,7 @@ assert.throws(() => {
}, unknownEncodingMessage);
assert.throws(() => {
fs.mkdtemp('path', options, noop);
fs.mkdtemp('path', options, common.noop);
}, unknownEncodingMessage);
assert.throws(() => {

14
test/parallel/test-fs-empty-readStream.js

@ -33,11 +33,9 @@ fs.open(emptyFile, 'r', common.mustCall((error, fd) => {
const read = fs.createReadStream(emptyFile, { fd });
read.once('data', () => {
common.fail('data event should not emit');
});
read.once('data', common.mustNotCall('data event should not emit'));
read.once('end', common.mustCall(function endEvent1() {}));
read.once('end', common.mustCall());
}));
fs.open(emptyFile, 'r', common.mustCall((error, fd) => {
@ -48,13 +46,9 @@ fs.open(emptyFile, 'r', common.mustCall((error, fd) => {
read.pause();
read.once('data', () => {
common.fail('data event should not emit');
});
read.once('data', common.mustNotCall('data event should not emit'));
read.once('end', function endEvent2() {
common.fail('end event should not emit');
});
read.once('end', common.mustNotCall('end event should not emit'));
setTimeout(common.mustCall(() => {
assert.strictEqual(read.isPaused(), true);

2
test/parallel/test-fs-make-callback.js

@ -12,7 +12,7 @@ function test(cb) {
}
// Verify the case where a callback function is provided
assert.doesNotThrow(test(function() {}));
assert.doesNotThrow(test(common.noop));
process.once('warning', common.mustCall((warning) => {
assert.strictEqual(

2
test/parallel/test-fs-mkdir.js

@ -77,4 +77,4 @@ common.refreshTmpDir();
// Keep the event loop alive so the async mkdir() requests
// have a chance to run (since they don't ref the event loop).
process.nextTick(function() {});
process.nextTick(common.noop);

6
test/parallel/test-fs-options-immutable.js

@ -63,12 +63,14 @@ if (!common.isAix) {
// https://github.com/nodejs/node/issues/5085 is fixed
{
let watch;
assert.doesNotThrow(() => watch = fs.watch(__filename, options, () => {}));
assert.doesNotThrow(() => {
watch = fs.watch(__filename, options, common.noop);
});
watch.close();
}
{
assert.doesNotThrow(() => fs.watchFile(__filename, options, () => {}));
assert.doesNotThrow(() => fs.watchFile(__filename, options, common.noop));
fs.unwatchFile(__filename);
}
}

4
test/parallel/test-fs-read-file-assert-encoding.js

@ -1,6 +1,6 @@
'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');
const fs = require('fs');
@ -8,6 +8,6 @@ const encoding = 'foo-8';
const filename = 'bar.txt';
assert.throws(
fs.readFile.bind(fs, filename, { encoding }, () => {}),
fs.readFile.bind(fs, filename, { encoding }, common.noop),
new RegExp(`Error: Unknown encoding: ${encoding}$`)
);

6
test/parallel/test-fs-read-stream-double-close.js

@ -5,7 +5,5 @@ const fs = require('fs');
const s = fs.createReadStream(__filename);
s.close(common.mustCall(noop));
s.close(common.mustCall(noop));
function noop() {}
s.close(common.mustCall());
s.close(common.mustCall());

12
test/parallel/test-fs-read-stream-inherit.js

@ -39,7 +39,7 @@ let paused = false;
});
file.on('end', common.mustCall(function() {}));
file.on('end', common.mustCall());
file.on('close', common.mustCall(function() {
@ -139,7 +139,7 @@ let paused = false;
let file7 =
fs.createReadStream(rangeFile, Object.create({autoClose: false }));
assert.strictEqual(file7.autoClose, false);
file7.on('data', function() {});
file7.on('data', common.noop);
file7.on('end', common.mustCall(function() {
process.nextTick(common.mustCall(function() {
assert(!file7.closed);
@ -169,8 +169,8 @@ let paused = false;
{
const options = Object.create({fd: 13337, autoClose: false});
const file8 = fs.createReadStream(null, options);
file8.on('data', function() {});
file8.on('error', common.mustCall(function() {}));
file8.on('data', common.noop);
file8.on('error', common.mustCall());
process.on('exit', function() {
assert(!file8.closed);
assert(!file8.destroyed);
@ -181,8 +181,8 @@ let paused = false;
// Make sure stream is destroyed when file does not exist.
{
const file9 = fs.createReadStream('/path/to/file/that/does/not/exist');
file9.on('data', function() {});
file9.on('error', common.mustCall(function() {}));
file9.on('data', common.noop);
file9.on('error', common.mustCall());
process.on('exit', function() {
assert(!file9.closed);

10
test/parallel/test-fs-read-stream.js

@ -159,7 +159,7 @@ pauseRes.pause();
pauseRes.resume();
let file7 = fs.createReadStream(rangeFile, {autoClose: false });
file7.on('data', function() {});
file7.on('data', common.noop);
file7.on('end', function() {
process.nextTick(function() {
assert(!file7.closed);
@ -182,13 +182,13 @@ function file7Next() {
// Just to make sure autoClose won't close the stream because of error.
const file8 = fs.createReadStream(null, {fd: 13337, autoClose: false });
file8.on('data', function() {});
file8.on('error', common.mustCall(function() {}));
file8.on('data', common.noop);
file8.on('error', common.mustCall());
// Make sure stream is destroyed when file does not exist.
const file9 = fs.createReadStream('/path/to/file/that/does/not/exist');
file9.on('data', function() {});
file9.on('error', common.mustCall(function() {}));
file9.on('data', common.noop);
file9.on('error', common.mustCall());
process.on('exit', function() {
assert(file7.closed);

2
test/parallel/test-fs-read-type.js

@ -13,7 +13,7 @@ assert.throws(() => {
expected.length,
0,
'utf-8',
() => {});
common.noop);
}, /Second argument needs to be a buffer/);
assert.throws(() => {

2
test/parallel/test-fs-watch-stop-async.js

@ -3,7 +3,7 @@ const common = require('../common');
const assert = require('assert');
const fs = require('fs');
const watch = fs.watchFile(__filename, () => {});
const watch = fs.watchFile(__filename, common.noop);
let triggered;
const listener = common.mustCall(() => {
triggered = true;

5
test/parallel/test-fs-watch-stop-sync.js

@ -1,9 +1,10 @@
'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');
const fs = require('fs');
const watch = fs.watchFile(__filename, () => {});
const watch = fs.watchFile(__filename, common.noop);
watch.once('stop', assert.fail); // Should not trigger.
watch.stop();
watch.removeListener('stop', assert.fail);

2
test/parallel/test-fs-watchfile.js

@ -15,7 +15,7 @@ assert.throws(function() {
}, /"watchFile\(\)" requires a listener function/);
assert.throws(function() {
fs.watchFile(new Object(), function() {});
fs.watchFile(new Object(), common.noop);
}, /Path must be a string/);
const enoentFile = path.join(common.tmpDir, 'non-existent-file');

6
test/parallel/test-fs-write-stream-double-close.js

@ -8,7 +8,5 @@ common.refreshTmpDir();
const s = fs.createWriteStream(path.join(common.tmpDir, 'rw'));
s.close(common.mustCall(noop));
s.close(common.mustCall(noop));
function noop() {}
s.close(common.mustCall());
s.close(common.mustCall());

2
test/parallel/test-fs-write-stream-end.js

@ -31,7 +31,7 @@ common.refreshTmpDir();
const file = path.join(common.tmpDir, 'write-end-test0.txt');
const stream = fs.createWriteStream(file);
stream.end();
stream.on('close', common.mustCall(function() { }));
stream.on('close', common.mustCall());
}
{

4
test/parallel/test-global-console-exists.js

@ -35,8 +35,8 @@ const old_default = EventEmitter.defaultMaxListeners;
EventEmitter.defaultMaxListeners = 1;
const e = new EventEmitter();
e.on('hello', () => {});
e.on('hello', () => {});
e.on('hello', common.noop);
e.on('hello', common.noop);
// TODO: Figure out how to validate console. Currently,
// there is no obvious way of validating that console

2
test/parallel/test-handle-wrap-close-abort.js

@ -22,7 +22,7 @@
'use strict';
const common = require('../common');
process.on('uncaughtException', common.mustCall(function() {}, 2));
process.on('uncaughtException', common.mustCall(2));
setTimeout(function() {
process.nextTick(function() {

4
test/parallel/test-handle-wrap-isrefed.js

@ -87,7 +87,7 @@ const strictEqual = require('assert').strictEqual;
// tcp
{
const net = require('net');
const server = net.createServer(() => {}).listen(0);
const server = net.createServer(common.noop).listen(0);
strictEqual(Object.getPrototypeOf(server._handle).hasOwnProperty('hasRef'),
true, 'tcp_wrap: hasRef() missing');
strictEqual(server._handle.hasRef(),
@ -112,7 +112,7 @@ const strictEqual = require('assert').strictEqual;
// timers
{
const timer = setTimeout(() => {}, 500);
const timer = setTimeout(common.noop, 500);
timer.unref();
strictEqual(Object.getPrototypeOf(timer._handle).hasOwnProperty('hasRef'),
true, 'timer_wrap: hasRef() missing');

2
test/parallel/test-http-abort-client.js

@ -59,6 +59,6 @@ server.listen(0, common.mustCall(function() {
});
// it would be nice if this worked:
res.on('close', common.mustCall(function() {}));
res.on('close', common.mustCall());
}));
}));

2
test/parallel/test-http-client-aborted-event.js

@ -13,6 +13,6 @@ server.listen(0, common.mustCall(function() {
headers: { connection: 'keep-alive' }
}, common.mustCall(function(res) {
server.close();
res.on('aborted', common.mustCall(function() {}));
res.on('aborted', common.mustCall());
}));
}));

11
test/parallel/test-http-client-defaults.js

@ -1,24 +1,23 @@
'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');
const ClientRequest = require('http').ClientRequest;
function noop() {}
{
const req = new ClientRequest({ createConnection: noop });
const req = new ClientRequest({ createConnection: common.noop });
assert.strictEqual(req.path, '/');
assert.strictEqual(req.method, 'GET');
}
{
const req = new ClientRequest({ method: '', createConnection: noop });
const req = new ClientRequest({ method: '', createConnection: common.noop });
assert.strictEqual(req.path, '/');
assert.strictEqual(req.method, 'GET');
}
{
const req = new ClientRequest({ path: '', createConnection: noop });
const req = new ClientRequest({ path: '', createConnection: common.noop });
assert.strictEqual(req.path, '/');
assert.strictEqual(req.method, 'GET');
}

2
test/parallel/test-http-connect-req-res.js

@ -33,7 +33,7 @@ server.listen(0, common.mustCall(function() {
path: 'example.com:443'
}, common.mustNotCall());
req.on('close', common.mustCall(function() { }));
req.on('close', common.mustCall());
req.on('connect', common.mustCall(function(res, socket, firstBodyChunk) {
console.error('Client got CONNECT request');

2
test/parallel/test-http-connect.js

@ -49,7 +49,7 @@ server.listen(0, common.mustCall(function() {
path: 'google.com:443'
}, common.mustNotCall());
req.on('close', common.mustCall(() => {}));
req.on('close', common.mustCall());
req.on('connect', common.mustCall((res, socket, firstBodyChunk) => {
// Make sure this request got removed from the pool.

2
test/parallel/test-http-end-throw-socket-handling.js

@ -49,4 +49,4 @@ server.listen(0, common.mustCall(() => {
}
}));
process.on('uncaughtException', common.mustCall(() => {}, 10));
process.on('uncaughtException', common.mustCall(10));

5
test/parallel/test-http-eof-on-connect.js

@ -20,7 +20,8 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
'use strict';
require('../common');
const common = require('../common');
const net = require('net');
const http = require('http');
@ -28,7 +29,7 @@ const http = require('http');
// It is separate from test-http-malformed-request.js because it is only
// reproduceable on the first packet on the first connection to a server.
const server = http.createServer(function(req, res) {});
const server = http.createServer(common.noop);
server.listen(0);
server.on('listening', function() {

5
test/parallel/test-http-invalidheaderfield.js

@ -1,5 +1,6 @@
'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');
const EventEmitter = require('events');
const http = require('http');
@ -28,7 +29,7 @@ server.listen(0, function() {
port: server.address().port,
headers: {'testing 123': 123}
};
http.get(options, function() {});
http.get(options, common.noop);
},
function(err) {
ee.emit('done');

4
test/parallel/test-http-parser-bad-ref.js

@ -4,7 +4,7 @@
// Flags: --expose_gc
require('../common');
const common = require('../common');
const assert = require('assert');
const HTTPParser = process.binding('http_parser').HTTPParser;
@ -39,7 +39,7 @@ function demoBug(part1, part2) {
console.log('url', info.url);
};
parser[kOnBody] = function(b, start, len) { };
parser[kOnBody] = common.noop;
parser[kOnMessageComplete] = function() {
messagesComplete++;

2
test/parallel/test-http-pause-resume-one-end.js

@ -43,6 +43,6 @@ server.listen(0, common.mustCall(function() {
});
}));
res.on('end', common.mustCall(function() {}));
res.on('end', common.mustCall());
}));
}));

2
test/parallel/test-http-pipeline-flood.js

@ -46,7 +46,7 @@ function parent() {
res.end();
});
server.on('connection', common.mustCall(function(conn) {}));
server.on('connection', common.mustCall());
server.listen(0, function() {
const spawn = require('child_process').spawn;

2
test/parallel/test-http-server-reject-chunked-with-content-length.js

@ -25,5 +25,5 @@ server.listen(0, () => {
// close the connection without returning any data.
common.fail('no data should be returned by the server');
});
client.on('end', common.mustCall(() => {}));
client.on('end', common.mustCall());
});

8
test/parallel/test-http-set-timeout-server.js

@ -52,7 +52,7 @@ test(function serverTimeout(cb) {
// just do nothing, we should get a timeout event.
});
server.listen(common.mustCall(function() {
http.get({ port: server.address().port }).on('error', function() {});
http.get({ port: server.address().port }).on('error', common.noop);
}));
const s = server.setTimeout(50, function(socket) {
caughtTimeout = true;
@ -81,7 +81,7 @@ test(function serverRequestTimeout(cb) {
server.listen(common.mustCall(function() {
const port = server.address().port;
const req = http.request({ port: port, method: 'POST' });
req.on('error', function() {});
req.on('error', common.noop);
req.write('Hello');
// req is in progress
}));
@ -104,7 +104,7 @@ test(function serverResponseTimeout(cb) {
});
server.listen(common.mustCall(function() {
const port = server.address().port;
http.get({ port: port }).on('error', function() {});
http.get({ port: port }).on('error', common.noop);
}));
});
@ -132,7 +132,7 @@ test(function serverRequestNotTimeoutAfterEnd(cb) {
});
server.listen(common.mustCall(function() {
const port = server.address().port;
http.get({ port: port }).on('error', function() {});
http.get({ port: port }).on('error', common.noop);
}));
});

5
test/parallel/test-http-upgrade-server.js

@ -20,7 +20,8 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');
const util = require('util');
@ -37,7 +38,7 @@ function createTestServer() {
}
function testServer() {
http.Server.call(this, function() {});
http.Server.call(this, common.noop);
this.on('connection', function() {
requests_recv++;

4
test/parallel/test-https-close.js

@ -31,7 +31,7 @@ server.on('connection', function(connection) {
});
function shutdown() {
server.close(common.mustCall(function() {}));
server.close(common.mustCall());
for (const key in connections) {
connections[key].destroy();
@ -49,7 +49,7 @@ server.listen(0, function() {
};
const req = https.request(requestOptions, function(res) {
res.on('data', function(d) {});
res.on('data', common.noop);
setImmediate(shutdown);
});
req.end();

10
test/parallel/test-https-set-timeout-server.js

@ -69,7 +69,7 @@ test(function serverTimeout(cb) {
https.get({
port: this.address().port,
rejectUnauthorized: false
}).on('error', function() {});
}).on('error', common.noop);
}));
});
@ -90,7 +90,7 @@ test(function serverRequestTimeout(cb) {
method: 'POST',
rejectUnauthorized: false
});
req.on('error', function() {});
req.on('error', common.noop);
req.write('Hello');
// req is in progress
});
@ -111,7 +111,7 @@ test(function serverResponseTimeout(cb) {
https.get({
port: this.address().port,
rejectUnauthorized: false
}).on('error', function() {});
}).on('error', common.noop);
});
});
@ -119,7 +119,7 @@ test(function serverRequestNotTimeoutAfterEnd(cb) {
function handler(req, res) {
// just do nothing, we should get a timeout event.
req.setTimeout(50, common.mustNotCall());
res.on('timeout', common.mustCall(function(socket) {}));
res.on('timeout', common.mustCall());
}
const server = https.createServer(serverOptions, common.mustCall(handler));
server.on('timeout', function(socket) {
@ -131,7 +131,7 @@ test(function serverRequestNotTimeoutAfterEnd(cb) {
https.get({
port: this.address().port,
rejectUnauthorized: false
}).on('error', function() {});
}).on('error', common.noop);
});
});

4
test/parallel/test-https-socket-options.js

@ -58,7 +58,7 @@ server_http.listen(0, function() {
});
// These methods should exist on the request and get passed down to the socket
req.setNoDelay(true);
req.setTimeout(1000, function() { });
req.setTimeout(1000, common.noop);
req.setSocketKeepAlive(true, 1000);
req.end();
});
@ -82,7 +82,7 @@ server_https.listen(0, function() {
});
// These methods should exist on the request and get passed down to the socket
req.setNoDelay(true);
req.setTimeout(1000, function() { });
req.setTimeout(1000, common.noop);
req.setSocketKeepAlive(true, 1000);
req.end();
});

5
test/parallel/test-instanceof.js

@ -1,10 +1,11 @@
'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');
// Regression test for instanceof, see
// https://github.com/nodejs/node/issues/7592
const F = () => {};
const F = common.noop;
F.prototype = {};
assert(Object.create(F.prototype) instanceof F);

2
test/parallel/test-net-connect-options-ipv6.js

@ -36,7 +36,7 @@ let localhostTries = 10;
const server = net.createServer({allowHalfOpen: true}, function(socket) {
socket.resume();
socket.on('end', common.mustCall(function() {}));
socket.on('end', common.mustCall());
socket.end();
});

3
test/parallel/test-net-connect-options-port.js

@ -159,7 +159,8 @@ function syncFailToConnect(port, regexp, optOnly) {
}
function canConnect(port) {
const noop = () => common.mustCall(function() {});
const noop = () => common.mustCall();
// connect(port, cb) and connect(port)
const portArgBlocks = doConnect([port], noop);
for (const block of portArgBlocks) {

2
test/parallel/test-net-listen-close-server-callback-is-not-function.js

@ -4,7 +4,7 @@ const net = require('net');
const server = net.createServer(common.mustNotCall());
server.on('close', common.mustCall(function() {}));
server.on('close', common.mustCall());
server.listen(0, common.mustNotCall());

2
test/parallel/test-net-listen-error.js

@ -26,4 +26,4 @@ const net = require('net');
const server = net.createServer(function(socket) {
});
server.listen(1, '1.1.1.1', common.mustNotCall()); // EACCESS or EADDRNOTAVAIL
server.on('error', common.mustCall(function(error) {}));
server.on('error', common.mustCall());

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

Loading…
Cancel
Save