diff --git a/test/parallel/test-process-kill-null.js b/test/parallel/test-process-kill-null.js index 023724773f..88fc677454 100644 --- a/test/parallel/test-process-kill-null.js +++ b/test/parallel/test-process-kill-null.js @@ -20,29 +20,23 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -require('../common'); +const { mustCall } = require('../common'); const assert = require('assert'); -const spawn = require('child_process').spawn; +const { spawn } = require('child_process'); const cat = spawn('cat'); -let called; assert.ok(process.kill(cat.pid, 0)); -cat.on('exit', function() { +cat.on('exit', mustCall(function() { assert.throws(function() { process.kill(cat.pid, 0); }, Error); -}); +})); -cat.stdout.on('data', function() { - called = true; +cat.stdout.on('data', mustCall(function() { process.kill(cat.pid, 'SIGKILL'); -}); +})); // EPIPE when null sig fails cat.stdin.write('test'); - -process.on('exit', function() { - assert.ok(called); -});