diff options
author | christian-bromann <mail@christian-bromann.com> | 2018-10-12 10:43:58 -0700 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-10-21 06:04:27 +0200 |
commit | 6c5e97f2f0928851d613ce90a84a8f8baaba5083 (patch) | |
tree | d41e8e0fa05dbdd1a31337d7084af079009187d2 /test | |
parent | eff869feccb7396715fd2d0b47b6a1cbb5b2d1c2 (diff) | |
download | android-node-v8-6c5e97f2f0928851d613ce90a84a8f8baaba5083.tar.gz android-node-v8-6c5e97f2f0928851d613ce90a84a8f8baaba5083.tar.bz2 android-node-v8-6c5e97f2f0928851d613ce90a84a8f8baaba5083.zip |
test: increase coverage for readfile with withFileTypes
According to the test coverage report a test case was missings checking
if an error is passed into the callback for readdir calls with
withFileTypes option.
PR-URL: https://github.com/nodejs/node/pull/23557
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/parallel/test-fs-readdir-types.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/parallel/test-fs-readdir-types.js b/test/parallel/test-fs-readdir-types.js index 0faaeb00da..fa179eccfe 100644 --- a/test/parallel/test-fs-readdir-types.js +++ b/test/parallel/test-fs-readdir-types.js @@ -49,6 +49,19 @@ function assertDirents(dirents) { // Check the readdir Sync version assertDirents(fs.readdirSync(readdirDir, { withFileTypes: true })); +fs.readdir(__filename, { + withFileTypes: true +}, common.mustCall((err) => { + assert.throws( + () => { throw err; }, + { + code: 'ENOTDIR', + name: 'Error', + message: `ENOTDIR: not a directory, scandir '${__filename}'` + } + ); +})); + // Check the readdir async version fs.readdir(readdirDir, { withFileTypes: true |