Skip to content

Commit fa8315c

Browse files
lpincaMylesBorins
authored andcommitted
test: refactor test-process-kill-null
Use `common.mustCall()` instead of `called` variable. PR-URL: #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 9c96d7f commit fa8315c

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed
+6-12
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,21 @@
11
'use strict';
2-
require('../common');
2+
const { mustCall } = require('../common');
33
const assert = require('assert');
4-
const spawn = require('child_process').spawn;
4+
const { spawn } = require('child_process');
55

66
const cat = spawn('cat');
7-
let called;
87

98
assert.ok(process.kill(cat.pid, 0));
109

11-
cat.on('exit', function() {
10+
cat.on('exit', mustCall(function() {
1211
assert.throws(function() {
1312
process.kill(cat.pid, 0);
1413
}, Error);
15-
});
14+
}));
1615

17-
cat.stdout.on('data', function() {
18-
called = true;
16+
cat.stdout.on('data', mustCall(function() {
1917
process.kill(cat.pid, 'SIGKILL');
20-
});
18+
}));
2119

2220
// EPIPE when null sig fails
2321
cat.stdin.write('test');
24-
25-
process.on('exit', function() {
26-
assert.ok(called);
27-
});

0 commit comments

Comments
 (0)