Skip to content

Commit

Permalink
test: increase test coverage for readfile with withFileTypes option
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.
  • Loading branch information
christian-bromann committed Oct 15, 2018
1 parent d4ce144 commit e4151af
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 e4151af

Please sign in to comment.