Skip to content

Commit cb63808

Browse files
QueueHefnergibfahn
authored andcommitted
test: improve test-process-kill-pid
PR-URL: #12588 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
1 parent ac825fc commit cb63808

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

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

+11-7
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,20 @@ const assert = require('assert');
1717
//
1818
// process.pid, String(process.pid): ourself
1919

20-
assert.throws(function() { process.kill('SIGTERM'); }, TypeError);
21-
assert.throws(function() { process.kill(null); }, TypeError);
22-
assert.throws(function() { process.kill(undefined); }, TypeError);
23-
assert.throws(function() { process.kill(+'not a number'); }, TypeError);
24-
assert.throws(function() { process.kill(1 / 0); }, TypeError);
25-
assert.throws(function() { process.kill(-1 / 0); }, TypeError);
20+
assert.throws(function() { process.kill('SIGTERM'); },
21+
/^TypeError: invalid pid$/);
22+
assert.throws(function() { process.kill(null); }, /^TypeError: invalid pid$/);
23+
assert.throws(function() { process.kill(undefined); },
24+
/^TypeError: invalid pid$/);
25+
assert.throws(function() { process.kill(+'not a number'); },
26+
/^TypeError: invalid pid$/);
27+
assert.throws(function() { process.kill(1 / 0); }, /^TypeError: invalid pid$/);
28+
assert.throws(function() { process.kill(-1 / 0); }, /^TypeError: invalid pid$/);
2629

2730
// Test that kill throws an error for invalid signal
2831

29-
assert.throws(function() { process.kill(1, 'test'); }, Error);
32+
assert.throws(function() { process.kill(1, 'test'); },
33+
/^Error: Unknown signal: test$/);
3034

3135
// Test kill argument processing in valid cases.
3236
//

0 commit comments

Comments
 (0)