Skip to content

Commit

Permalink
test: increase coverage for readfile with withFileTypes
Browse files Browse the repository at this point in the history
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: nodejs#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>
  • Loading branch information
christian-bromann authored and addaleax committed Oct 21, 2018
1 parent eff869f commit 6c5e97f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/parallel/test-fs-readdir-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6c5e97f

Please sign in to comment.