Skip to content

Commit b19f339

Browse files
christian-bromannjasnell
authored andcommitted
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: #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>
1 parent 3b014a1 commit b19f339

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/parallel/test-fs-readdir-types.js

+13
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,19 @@ function assertDirents(dirents) {
4949
// Check the readdir Sync version
5050
assertDirents(fs.readdirSync(readdirDir, { withFileTypes: true }));
5151

52+
fs.readdir(__filename, {
53+
withFileTypes: true
54+
}, common.mustCall((err) => {
55+
assert.throws(
56+
() => { throw err; },
57+
{
58+
code: 'ENOTDIR',
59+
name: 'Error',
60+
message: `ENOTDIR: not a directory, scandir '${__filename}'`
61+
}
62+
);
63+
}));
64+
5265
// Check the readdir async version
5366
fs.readdir(readdirDir, {
5467
withFileTypes: true

0 commit comments

Comments
 (0)