diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2017-12-25 05:01:11 +0800 |
---|---|---|
committer | Anatoli Papirovski <apapirovski@mac.com> | 2017-12-27 12:47:45 -0500 |
commit | 71396a200d75b11a71af7caae18d12f3dc461d07 (patch) | |
tree | 795ff91feded0ffd926e3bbc46d75a474627d8c0 /test/parallel/test-fs-exists.js | |
parent | 9ec700b073894ad54432db4c4b540e2b61b45325 (diff) | |
download | android-node-v8-71396a200d75b11a71af7caae18d12f3dc461d07.tar.gz android-node-v8-71396a200d75b11a71af7caae18d12f3dc461d07.tar.bz2 android-node-v8-71396a200d75b11a71af7caae18d12f3dc461d07.zip |
fs: validate path in fs.exists{Sync}
PR-URL: https://github.com/nodejs/node/pull/17852
Refs: https://github.com/nodejs/node/pull/17667
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'test/parallel/test-fs-exists.js')
-rw-r--r-- | test/parallel/test-fs-exists.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/parallel/test-fs-exists.js b/test/parallel/test-fs-exists.js index 331c8c04e3..a526373c6a 100644 --- a/test/parallel/test-fs-exists.js +++ b/test/parallel/test-fs-exists.js @@ -42,3 +42,14 @@ fs.exists(new URL('https://foo'), common.mustCall(function(y) { assert(fs.existsSync(f)); assert(!fs.existsSync(`${f}-NO`)); + +common.expectsError( + () => { fs.exists(() => {}); }, + { + code: 'ERR_INVALID_ARG_TYPE', + message: 'The "path" argument must be one of type string, Buffer, or URL', + type: TypeError + } +); + +assert(!fs.existsSync()); |