summaryrefslogtreecommitdiff
path: root/test/parallel/test-internal-errors.js
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2017-02-10 08:51:50 -0800
committerJames M Snell <jasnell@gmail.com>2017-04-20 11:34:07 -0700
commite75bc87d2240097ddf4074c473b4ea946daf390d (patch)
treeed03f175a3efe6ed40ee30e96131f73c81734f7b /test/parallel/test-internal-errors.js
parent468275ac7911b3f7950f31e9799b6666c96f2c73 (diff)
downloadandroid-node-v8-e75bc87d2240097ddf4074c473b4ea946daf390d.tar.gz
android-node-v8-e75bc87d2240097ddf4074c473b4ea946daf390d.tar.bz2
android-node-v8-e75bc87d2240097ddf4074c473b4ea946daf390d.zip
errors: port internal/process errors to internal/errors
* Assign codes to the handful of errors reported by internal/process/*.js * Include documentation for the new error codes * Improve error messages * Improve test coverage for process.nextTick PR-URL: https://github.com/nodejs/node/pull/11294 Ref: https://github.com/nodejs/node/issues/11273 Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com>
Diffstat (limited to 'test/parallel/test-internal-errors.js')
-rw-r--r--test/parallel/test-internal-errors.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/parallel/test-internal-errors.js b/test/parallel/test-internal-errors.js
index b43d825e6c..fbd627b030 100644
--- a/test/parallel/test-internal-errors.js
+++ b/test/parallel/test-internal-errors.js
@@ -130,3 +130,23 @@ assert.throws(
() => errors.E('TEST_ERROR_USED_SYMBOL'),
/^AssertionError: Error symbol: TEST_ERROR_USED_SYMBOL was already used\.$/
);
+
+// // Test ERR_INVALID_ARG_TYPE
+assert.strictEqual(errors.message('ERR_INVALID_ARG_TYPE', ['a', 'b']),
+ 'The "a" argument must be of type b');
+assert.strictEqual(errors.message('ERR_INVALID_ARG_TYPE', ['a', ['b']]),
+ 'The "a" argument must be of type b');
+assert.strictEqual(errors.message('ERR_INVALID_ARG_TYPE', ['a', ['b', 'c']]),
+ 'The "a" argument must be one of type b, or c');
+assert.strictEqual(errors.message('ERR_INVALID_ARG_TYPE',
+ ['a', ['b', 'c', 'd']]),
+ 'The "a" argument must be one of type b, c, or d');
+assert.strictEqual(errors.message('ERR_INVALID_ARG_TYPE', ['a', 'b', 'c']),
+ 'The "a" argument must be of type b. Received type string');
+assert.strictEqual(errors.message('ERR_INVALID_ARG_TYPE',
+ ['a', 'b', undefined]),
+ 'The "a" argument must be of type b. Received type ' +
+ 'undefined');
+assert.strictEqual(errors.message('ERR_INVALID_ARG_TYPE',
+ ['a', 'b', null]),
+ 'The "a" argument must be of type b. Received type null');