From cb6380883222c7f9779ff28403e562e8c5b040d3 Mon Sep 17 00:00:00 2001 From: alohaglenn Date: Sat, 22 Apr 2017 10:53:56 -0700 Subject: [PATCH] test: improve test-process-kill-pid PR-URL: https://github.com/nodejs/node/pull/12588 Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Gibson Fahnestock --- test/parallel/test-process-kill-pid.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/test/parallel/test-process-kill-pid.js b/test/parallel/test-process-kill-pid.js index 79dc00163b78f8..959c07b58f2ff5 100644 --- a/test/parallel/test-process-kill-pid.js +++ b/test/parallel/test-process-kill-pid.js @@ -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. //