Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -38,16 +38,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