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: https://github.com/nodejs/node/pull/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>
This commit is contained in:
parent
eff869fecc
commit
6c5e97f2f0
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user