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 <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 jasnell committed Oct 21, 2018
1 parent 3b014a1 commit b19f339
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/parallel/test-fs-readdir-types.js
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 b19f339

Please sign in to comment.