Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorchristian-bromann <mail@christian-bromann.com>2018-10-12 20:43:58 +0300
committerMyles Borins <mylesborins@google.com>2018-11-29 19:39:04 +0300
commit9979c71d67a2adf8c86ed8bebffde55ba8cbfb98 (patch)
tree3e2d6f6d1b3d42e600e2817cd00c39d15bb707ce /test
parent3bc7b5efd281911176e0f143345c42de6fe86721 (diff)
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 0faaeb00dad..fa179eccfe2 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