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: #23557
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
christian-bromann authored and MylesBorins committed Nov 26, 2018
1 parent ce03aca commit 874371d
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 874371d

Please sign in to comment.