summaryrefslogtreecommitdiff
path: root/test/parallel/test-path-parse-format.js
diff options
context:
space:
mode:
authorTobias Nießen <tniessen@tnie.de>2017-06-30 21:31:21 +0200
committerTobias Nießen <tniessen@tnie.de>2017-07-03 16:28:02 +0200
commit44256bb0aaa54df60ec3d2c53bcfe7004fb61427 (patch)
tree420d92ab612a9ee68dbb894b3a892eb137832917 /test/parallel/test-path-parse-format.js
parent1d7414354e4cce9ebc48c4f7117170c746f12970 (diff)
downloadandroid-node-v8-44256bb0aaa54df60ec3d2c53bcfe7004fb61427.tar.gz
android-node-v8-44256bb0aaa54df60ec3d2c53bcfe7004fb61427.tar.bz2
android-node-v8-44256bb0aaa54df60ec3d2c53bcfe7004fb61427.zip
path: fix incorrect use of ERR_INVALID_ARG_TYPE
PR-URL: https://github.com/nodejs/node/pull/14011 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'test/parallel/test-path-parse-format.js')
-rw-r--r--test/parallel/test-path-parse-format.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/parallel/test-path-parse-format.js b/test/parallel/test-path-parse-format.js
index 24e49f3ffc..1c3bdff130 100644
--- a/test/parallel/test-path-parse-format.js
+++ b/test/parallel/test-path-parse-format.js
@@ -207,4 +207,19 @@ function checkFormat(path, testCases) {
testCases.forEach(function(testCase) {
assert.strictEqual(path.format(testCase[0]), testCase[1]);
});
+
+ function typeName(value) {
+ return value === null ? 'null' : typeof value;
+ }
+
+ [null, undefined, 1, true, false, 'string'].forEach((pathObject) => {
+ assert.throws(() => {
+ path.format(pathObject);
+ }, common.expectsError({
+ code: 'ERR_INVALID_ARG_TYPE',
+ type: TypeError,
+ message: 'The "pathObject" argument must be of type Object. Received ' +
+ 'type ' + typeName(pathObject)
+ }));
+ });
}