mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
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>
19 lines
539 B
JavaScript
19 lines
539 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const spawn = require('child_process').spawn;
|
|
const cat = spawn(common.isWindows ? 'cmd' : 'cat');
|
|
|
|
cat.stdout.on('end', common.mustCall());
|
|
cat.stderr.on('data', common.mustNotCall());
|
|
cat.stderr.on('end', common.mustCall());
|
|
|
|
cat.on('exit', common.mustCall(function(code, signal) {
|
|
assert.strictEqual(code, null);
|
|
assert.strictEqual(signal, 'SIGTERM');
|
|
}));
|
|
|
|
assert.strictEqual(cat.killed, false);
|
|
cat.kill();
|
|
assert.strictEqual(cat.killed, true);
|