Skip to content
Permalink
Browse files

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: #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>
  • Loading branch information...
jasnell committed Mar 24, 2017
1 parent d13bd4a commit 4f2e372716714ed030cb5ba6e67107b913f15343
Showing with 492 additions and 490 deletions.
  1. +15 −1 test/README.md
  2. +1 −1 test/addons/async-hello-world/test.js
  3. +1 −1 test/addons/heap-profiler/test.js
  4. +13 −3 test/common.js
  5. +2 −2 test/debugger/test-debugger-client.js
  6. +2 −2 test/message/unhandled_promise_trace_warnings.js
  7. +5 −5 test/parallel/test-assert.js
  8. +10 −12 test/parallel/test-async-wrap-check-providers.js
  9. +2 −4 test/parallel/test-async-wrap-disabled-propagate-parent.js
  10. +2 −4 test/parallel/test-async-wrap-propagate-parent.js
  11. +1 −1 test/parallel/test-async-wrap-throw-from-callback.js
  12. +3 −3 test/parallel/test-async-wrap-throw-no-init.js
  13. +2 −2 test/parallel/test-async-wrap-uid.js
  14. +2 −2 test/parallel/test-buffer-includes.js
  15. +1 −1 test/parallel/test-child-process-bad-stdio.js
  16. +1 −1 test/parallel/test-child-process-disconnect.js
  17. +2 −2 test/parallel/test-child-process-fork-ref2.js
  18. +2 −2 test/parallel/test-child-process-kill.js
  19. +2 −4 test/parallel/test-child-process-send-type-error.js
  20. +2 −2 test/parallel/test-child-process-spawnsync-kill-signal.js
  21. +10 −11 test/parallel/test-child-process-spawnsync-validation-errors.js
  22. +2 −2 test/parallel/test-child-process-stdin.js
  23. +1 −1 test/parallel/test-cluster-basic.js
  24. +3 −5 test/parallel/test-cluster-disconnect-leak.js
  25. +2 −2 test/parallel/test-cluster-eaccess.js
  26. +1 −1 test/parallel/test-cluster-http-pipe.js
  27. +2 −2 test/parallel/test-cluster-rr-domain-listen.js
  28. +1 −1 test/parallel/test-cluster-setup-master-emit.js
  29. +2 −2 test/parallel/test-cluster-worker-destroy.js
  30. +2 −2 test/parallel/test-cluster-worker-wait-server-close.js
  31. +1 −1 test/parallel/test-console-instance.js
  32. +1 −1 test/parallel/test-crypto-pbkdf2.js
  33. +1 −1 test/parallel/test-crypto-random.js
  34. +1 −1 test/parallel/test-debug-brk.js
  35. +2 −4 test/parallel/test-dgram-bind-shared-ports.js
  36. +1 −1 test/parallel/test-dgram-close-is-not-callback.js
  37. +2 −2 test/parallel/test-dgram-close.js
  38. +5 −6 test/parallel/test-dgram-oob-buffer.js
  39. +1 −1 test/parallel/test-dgram-send-empty-buffer.js
  40. +2 −2 test/parallel/test-dgram-udp4.js
  41. +2 −2 test/parallel/test-dns-lookup.js
  42. +26 −28 test/parallel/test-dns.js
  43. +3 −3 test/parallel/test-domain-crypto.js
  44. +1 −1 test/parallel/test-domain-exit-dispose.js
  45. +1 −1 test/parallel/test-domain-timers.js
  46. +2 −2 test/parallel/test-domain.js
  47. +17 −16 test/parallel/test-event-emitter-check-listener-leaks.js
  48. +3 −3 test/parallel/test-event-emitter-get-max-listeners.js
  49. +5 −5 test/parallel/test-event-emitter-listener-count.js
  50. +2 −2 test/parallel/test-event-emitter-max-listeners-warning-for-null.js
  51. +2 −2 test/parallel/test-event-emitter-max-listeners-warning-for-symbol.js
  52. +2 −2 test/parallel/test-event-emitter-max-listeners-warning.js
  53. +1 −1 test/parallel/test-event-emitter-max-listeners.js
  54. +2 −2 test/parallel/test-event-emitter-once.js
  55. +15 −17 test/parallel/test-event-emitter-remove-all-listeners.js
  56. +3 −3 test/parallel/test-event-emitter-remove-listeners.js
  57. +1 −1 test/parallel/test-event-emitter-special-event-names.js
  58. +2 −2 test/parallel/test-event-emitter-subclass.js
  59. +1 −1 test/parallel/test-event-emitter-symbols.js
  60. +1 −0 test/parallel/test-events-list.js
  61. +9 −10 test/parallel/test-fs-assert-encoding-error.js
  62. +4 −10 test/parallel/test-fs-empty-readStream.js
  63. +1 −1 test/parallel/test-fs-make-callback.js
  64. +1 −1 test/parallel/test-fs-mkdir.js
  65. +4 −2 test/parallel/test-fs-options-immutable.js
  66. +2 −2 test/parallel/test-fs-read-file-assert-encoding.js
  67. +2 −4 test/parallel/test-fs-read-stream-double-close.js
  68. +6 −6 test/parallel/test-fs-read-stream-inherit.js
  69. +5 −5 test/parallel/test-fs-read-stream.js
  70. +1 −1 test/parallel/test-fs-read-type.js
  71. +1 −1 test/parallel/test-fs-watch-stop-async.js
  72. +3 −2 test/parallel/test-fs-watch-stop-sync.js
  73. +1 −1 test/parallel/test-fs-watchfile.js
  74. +2 −4 test/parallel/test-fs-write-stream-double-close.js
  75. +1 −1 test/parallel/test-fs-write-stream-end.js
  76. +2 −2 test/parallel/test-global-console-exists.js
  77. +1 −1 test/parallel/test-handle-wrap-close-abort.js
  78. +2 −2 test/parallel/test-handle-wrap-isrefed.js
  79. +1 −1 test/parallel/test-http-abort-client.js
  80. +1 −1 test/parallel/test-http-client-aborted-event.js
  81. +5 −6 test/parallel/test-http-client-defaults.js
  82. +1 −1 test/parallel/test-http-connect-req-res.js
  83. +1 −1 test/parallel/test-http-connect.js
  84. +1 −1 test/parallel/test-http-end-throw-socket-handling.js
  85. +3 −2 test/parallel/test-http-eof-on-connect.js
  86. +3 −2 test/parallel/test-http-invalidheaderfield.js
  87. +2 −2 test/parallel/test-http-parser-bad-ref.js
  88. +1 −1 test/parallel/test-http-pause-resume-one-end.js
  89. +1 −1 test/parallel/test-http-pipeline-flood.js
  90. +1 −1 test/parallel/test-http-server-reject-chunked-with-content-length.js
  91. +4 −4 test/parallel/test-http-set-timeout-server.js
  92. +3 −2 test/parallel/test-http-upgrade-server.js
  93. +2 −2 test/parallel/test-https-close.js
  94. +5 −5 test/parallel/test-https-set-timeout-server.js
  95. +2 −2 test/parallel/test-https-socket-options.js
  96. +3 −2 test/parallel/test-instanceof.js
  97. +1 −1 test/parallel/test-net-connect-options-ipv6.js
  98. +2 −1 test/parallel/test-net-connect-options-port.js
  99. +1 −1 test/parallel/test-net-listen-close-server-callback-is-not-function.js
  100. +1 −1 test/parallel/test-net-listen-error.js
  101. +3 −4 test/parallel/test-net-listen-exclusive-random-ports.js
  102. +2 −4 test/parallel/test-net-listen-shared-ports.js
  103. +1 −1 test/parallel/test-net-options-lookup.js
  104. +5 −5 test/parallel/test-net-server-bind.js
  105. +1 −1 test/parallel/test-net-socket-destroy-twice.js
  106. +4 −5 test/parallel/test-net-socket-timeout.js
  107. +3 −2 test/parallel/test-net-stream.js
  108. +1 −1 test/parallel/test-net-write-after-close.js
  109. +3 −3 test/parallel/test-next-tick.js
  110. +1 −1 test/parallel/test-no-enter-tickcallback.js
  111. +2 −2 test/parallel/test-process-getactiverequests.js
  112. +1 −1 test/parallel/test-process-next-tick.js
  113. +1 −1 test/parallel/test-promises-warning-on-unhandled-rejection.js
  114. +5 −5 test/parallel/test-readline-interface.js
  115. +1 −1 test/parallel/test-readline-keys.js
  116. +3 −3 test/parallel/test-regress-GH-4948.js
  117. +1 −1 test/parallel/test-regress-GH-5051.js
  118. +3 −3 test/parallel/test-repl-.save.load.js
  119. +1 −1 test/parallel/test-repl-function-definition-edge-case.js
  120. +1 −1 test/parallel/test-repl-history-perm.js
  121. +1 −1 test/parallel/test-repl-mode.js
  122. +1 −1 test/parallel/test-repl-tab-complete-crash.js
  123. +2 −2 test/parallel/test-signal-handler.js
  124. +1 −1 test/parallel/test-stdout-close-unref.js
  125. +2 −2 test/parallel/test-stream-base-no-abort.js
  126. +1 −1 test/parallel/test-stream-big-push.js
  127. +3 −2 test/parallel/test-stream-decoder-objectmode.js
  128. +3 −3 test/parallel/test-stream-duplex.js
  129. +1 −1 test/parallel/test-stream-end-paused.js
  130. +1 −1 test/parallel/test-stream-events-prepend.js
  131. +2 −2 test/parallel/test-stream-pipe-after-end.js
  132. +1 −1 test/parallel/test-stream-pipe-await-drain.js
  133. +1 −1 test/parallel/test-stream-pipe-cleanup-pause.js
  134. +3 −3 test/parallel/test-stream-pipe-error-handling.js
  135. +3 −3 test/parallel/test-stream-pipe-multiple-pipes.js
  136. +5 −5 test/parallel/test-stream-pipe-unpipe-streams.js
  137. +2 −4 test/parallel/test-stream-pipe-without-listenerCount.js
  138. +3 −3 test/parallel/test-stream-readable-emittedReadable.js
  139. +4 −4 test/parallel/test-stream-readable-event.js
  140. +3 −2 test/parallel/test-stream-readable-invalid-chunk.js
  141. +4 −4 test/parallel/test-stream-readable-needReadable.js
  142. +2 −2 test/parallel/test-stream-readableListening-state.js
  143. +1 −1 test/parallel/test-stream-wrap.js
  144. +7 −8 test/parallel/test-stream2-objects.js
  145. +2 −2 test/parallel/test-stream2-pipe-error-once-listener.js
  146. +1 −1 test/parallel/test-stream2-read-sync-stack.js
  147. +2 −2 test/parallel/test-stream2-readable-legacy-drain.js
  148. +1 −1 test/parallel/test-stream2-readable-non-empty-end.js
  149. +4 −4 test/parallel/test-stream2-readable-wrap-empty.js
  150. +1 −1 test/parallel/test-stream2-readable-wrap.js
  151. +6 −5 test/parallel/test-stream2-writable.js
  152. +1 −1 test/parallel/test-timer-close.js
  153. +1 −1 test/parallel/test-timers-uncaught-exception.js
  154. +1 −1 test/parallel/test-timers-unenroll-unref-interval.js
  155. +3 −2 test/parallel/test-timers-unref-call.js
  156. +1 −1 test/parallel/test-timers-unref-remove-other-unref-timers.js
  157. +5 −4 test/parallel/test-timers-unref.js
  158. +2 −2 test/parallel/test-timers-unrefed-in-beforeexit.js
  159. +1 −1 test/parallel/test-timers-zero-timeout.js
  160. +1 −1 test/parallel/test-timers.js
  161. +1 −1 test/parallel/test-tls-cert-regression.js
  162. +1 −1 test/parallel/test-tls-close-error.js
  163. +2 −2 test/parallel/test-tls-connect-simple.js
  164. +2 −2 test/parallel/test-tls-connect.js
  165. +1 −1 test/parallel/test-tls-delayed-attach-error.js
  166. +1 −1 test/parallel/test-tls-env-extra-ca.js
  167. +1 −2 test/parallel/test-tls-getcipher.js
  168. +1 −1 test/parallel/test-tls-invoke-queued.js
  169. +22 −22 test/parallel/test-tls-passphrase.js
  170. +1 −1 test/parallel/test-tls-two-cas-one-string.js
  171. +3 −3 test/parallel/test-util-inspect.js
  172. +1 −1 test/parallel/test-vm-sigint-existing-handler.js
  173. +1 −1 test/parallel/test-whatwg-url-parsing.js
  174. +1 −1 test/parallel/test-zlib-close-after-write.js
  175. +1 −1 test/parallel/test-zlib-write-after-close.js
  176. +1 −1 test/parallel/test-zlib-zero-byte.js
  177. +3 −2 test/pseudo-tty/ref_keeps_node_running.js
  178. +2 −2 test/pummel/test-http-client-reconnect-bug.js
  179. +7 −8 test/pummel/test-stream2-basic.js
  180. +1 −1 test/sequential/test-child-process-pass-fd.js
  181. +1 −1 test/sequential/test-debug-host-port.js
  182. +2 −2 test/sequential/test-fs-watch.js
  183. +2 −2 test/sequential/test-net-GH-5504.js
  184. +1 −1 test/sequential/test-pipe.js
@@ -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,13 +333,27 @@ 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)
* return [&lt;Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type)

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)

@@ -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());
}));
@@ -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.
@@ -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,
@@ -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++;
@@ -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));
@@ -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$/
);
}
@@ -39,50 +39,48 @@ 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();

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


@@ -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 {
@@ -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/);
@@ -1,14 +1,14 @@
'use strict';

require('../common');
const common = require('../common');
const fs = require('fs');
const assert = require('assert');
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();
@@ -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({});
@@ -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;
}

@@ -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) {
@@ -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 {
@@ -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);

0 comments on commit 4f2e372

Please sign in to comment.
You can’t perform that action at this time.