diff options
author | James M Snell <jasnell@gmail.com> | 2017-12-13 14:24:34 -0800 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2017-12-22 12:49:10 -0800 |
commit | 6100e12667429acad1827b6d918e512e55a7a6a7 (patch) | |
tree | 4fac815add3abf5d54112723798ecc78cb3e06fa /test/parallel/test-fs-readdir.js | |
parent | 92fc14a4595d460394cad8ad5a091dcc450068a5 (diff) | |
download | android-node-v8-6100e12667429acad1827b6d918e512e55a7a6a7.tar.gz android-node-v8-6100e12667429acad1827b6d918e512e55a7a6a7.tar.bz2 android-node-v8-6100e12667429acad1827b6d918e512e55a7a6a7.zip |
fs: move type checking to js
PR-URL: https://github.com/nodejs/node/pull/17667
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'test/parallel/test-fs-readdir.js')
-rw-r--r-- | test/parallel/test-fs-readdir.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/parallel/test-fs-readdir.js b/test/parallel/test-fs-readdir.js index a5c7ebfe68..76e6a4dc37 100644 --- a/test/parallel/test-fs-readdir.js +++ b/test/parallel/test-fs-readdir.js @@ -33,3 +33,20 @@ assert.throws(function() { fs.readdir(__filename, common.mustCall(function(e) { assert.strictEqual(e.code, 'ENOTDIR'); })); + +[false, 1, [], {}, null, undefined].forEach((i) => { + common.expectsError( + () => fs.readdir(i, common.mustNotCall()), + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError + } + ); + common.expectsError( + () => fs.readdirSync(i), + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError + } + ); +}); |