diff options
author | sreepurnajasti <sreepurna.jasti@gmail.com> | 2017-06-02 12:35:36 -0400 |
---|---|---|
committer | Michael Dawson <michael_dawson@ca.ibm.com> | 2017-06-05 15:15:58 -0400 |
commit | 062071a9c37fa10b3f17f11231e1dfbc3db015d1 (patch) | |
tree | b23953addda5240a4808f3a60166c20043c8f4d3 /test/parallel/test-process-kill-pid.js | |
parent | 7024c5a3026b9130a7dc3c8499dc49fb21b9fa90 (diff) | |
download | android-node-v8-062071a9c37fa10b3f17f11231e1dfbc3db015d1.tar.gz android-node-v8-062071a9c37fa10b3f17f11231e1dfbc3db015d1.tar.bz2 android-node-v8-062071a9c37fa10b3f17f11231e1dfbc3db015d1.zip |
errors,process: migrate to use internal/errors.js
PR-URL: https://github.com/nodejs/node/pull/13285
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Diffstat (limited to 'test/parallel/test-process-kill-pid.js')
-rw-r--r-- | test/parallel/test-process-kill-pid.js | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/test/parallel/test-process-kill-pid.js b/test/parallel/test-process-kill-pid.js index 3c2d684c46..bf6f552fb0 100644 --- a/test/parallel/test-process-kill-pid.js +++ b/test/parallel/test-process-kill-pid.js @@ -20,7 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); // test variants of pid @@ -38,20 +38,35 @@ const assert = require('assert'); // // process.pid, String(process.pid): ourself +const invalidPidArgument = common.expectsError({ + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError, + message: 'The "pid" argument must be of type Number' +}); + assert.throws(function() { process.kill('SIGTERM'); }, - /^TypeError: invalid pid$/); -assert.throws(function() { process.kill(null); }, /^TypeError: invalid pid$/); + invalidPidArgument); +assert.throws(function() { process.kill(null); }, + invalidPidArgument); assert.throws(function() { process.kill(undefined); }, - /^TypeError: invalid pid$/); + invalidPidArgument); 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$/); + invalidPidArgument); +assert.throws(function() { process.kill(1 / 0); }, + invalidPidArgument); +assert.throws(function() { process.kill(-1 / 0); }, + invalidPidArgument); // Test that kill throws an error for invalid signal +const unknownSignal = common.expectsError({ + code: 'ERR_UNKNOWN_SIGNAL', + type: Error, + message: 'Unknown signal: test' +}); + assert.throws(function() { process.kill(1, 'test'); }, - /^Error: Unknown signal: test$/); + unknownSignal); // Test kill argument processing in valid cases. // |