summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorchristian-bromann <mail@christian-bromann.com>2018-10-12 10:43:58 -0700
committerAnna Henningsen <anna@addaleax.net>2018-10-21 06:04:27 +0200
commit6c5e97f2f0928851d613ce90a84a8f8baaba5083 (patch)
treed41e8e0fa05dbdd1a31337d7084af079009187d2 /test
parenteff869feccb7396715fd2d0b47b6a1cbb5b2d1c2 (diff)
downloadandroid-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.js13
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