Skip to content

Commit 60159b6

Browse files
QueueHefnerevanlucas
authored andcommitted
test: improve test-process-kill-pid
PR-URL: #12588 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]>
1 parent 1a84f06 commit 60159b6

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

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

Lines changed: 11 additions & 7 deletions
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:invalidpid$/);
22+
assert.throws(function(){process.kill(null);},/^TypeError:invalidpid$/);
23+
assert.throws(function(){process.kill(undefined);},
24+
/^TypeError:invalidpid$/);
25+
assert.throws(function(){process.kill(+'not a number');},
26+
/^TypeError:invalidpid$/);
27+
assert.throws(function(){process.kill(1/0);},/^TypeError:invalidpid$/);
28+
assert.throws(function(){process.kill(-1/0);},/^TypeError:invalidpid$/);
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:Unknownsignal:test$/);
3034

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

0 commit comments

Comments
(0)