Skip to content
This repository was archived by the owner on Aug 31, 2018. It is now read-only.

Commit d106a9b

Browse files
lpincaaddaleax
authored andcommitted
test: refactor test-process-kill-null
Use `common.mustCall()` instead of `called` variable. PR-URL: nodejs/node#16236 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent d90b9fc commit d106a9b

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

test/parallel/test-process-kill-null.js

+6-12
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,23 @@
2020
// USE OR OTHER DEALINGS IN THE SOFTWARE.
2121

2222
'use strict';
23-
require('../common');
23+
const { mustCall } = require('../common');
2424
const assert = require('assert');
25-
const spawn = require('child_process').spawn;
25+
const { spawn } = require('child_process');
2626

2727
const cat = spawn('cat');
28-
let called;
2928

3029
assert.ok(process.kill(cat.pid, 0));
3130

32-
cat.on('exit', function() {
31+
cat.on('exit', mustCall(function() {
3332
assert.throws(function() {
3433
process.kill(cat.pid, 0);
3534
}, Error);
36-
});
35+
}));
3736

38-
cat.stdout.on('data', function() {
39-
called = true;
37+
cat.stdout.on('data', mustCall(function() {
4038
process.kill(cat.pid, 'SIGKILL');
41-
});
39+
}));
4240

4341
// EPIPE when null sig fails
4442
cat.stdin.write('test');
45-
46-
process.on('exit', function() {
47-
assert.ok(called);
48-
});

0 commit comments

Comments
 (0)