Skip to content

Commit

Permalink
test: improve test-process-kill-pid
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
QueueHefner authored and evanlucas committed May 2, 2017
1 parent 660e58c commit 8e6d440
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions test/parallel/test-process-kill-pid.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,20 @@ const assert = require('assert');
//
// process.pid, String(process.pid): ourself

assert.throws(function() { process.kill('SIGTERM'); }, TypeError);
assert.throws(function() { process.kill(null); }, TypeError);
assert.throws(function() { process.kill(undefined); }, TypeError);
assert.throws(function() { process.kill(+'not a number'); }, TypeError);
assert.throws(function() { process.kill(1 / 0); }, TypeError);
assert.throws(function() { process.kill(-1 / 0); }, TypeError);
assert.throws(function() { process.kill('SIGTERM'); },
/^TypeError: invalid pid$/);
assert.throws(function() { process.kill(null); }, /^TypeError: invalid pid$/);
assert.throws(function() { process.kill(undefined); },
/^TypeError: invalid pid$/);
assert.throws(function() { process.kill(+'not a number'); },
/^TypeError: invalid pid$/);
assert.throws(function() { process.kill(1 / 0); }, /^TypeError: invalid pid$/);
assert.throws(function() { process.kill(-1 / 0); }, /^TypeError: invalid pid$/);

// Test that kill throws an error for invalid signal

assert.throws(function() { process.kill(1, 'test'); }, Error);
assert.throws(function() { process.kill(1, 'test'); },
/^Error: Unknown signal: test$/);

// Test kill argument processing in valid cases.
//
Expand Down

0 comments on commit 8e6d440

Please sign in to comment.