Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 874371d

Browse filesBrowse files
christian-bromannMylesBorins
authored andcommitted
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: #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>
1 parent ce03aca commit 874371d
Copy full SHA for 874371d

File tree

Expand file treeCollapse file tree

1 file changed

+13
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+13
-0
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-fs-readdir-types.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-fs-readdir-types.js
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,19 @@ function assertDirents(dirents) {
4949
// Check the readdir Sync version
5050
assertDirents(fs.readdirSync(readdirDir, { withFileTypes: true }));
5151

52+
fs.readdir(__filename, {
53+
withFileTypes: true
54+
}, common.mustCall((err) => {
55+
assert.throws(
56+
() => { throw err; },
57+
{
58+
code: 'ENOTDIR',
59+
name: 'Error',
60+
message: `ENOTDIR: not a directory, scandir '${__filename}'`
61+
}
62+
);
63+
}));
64+
5265
// Check the readdir async version
5366
fs.readdir(readdirDir, {
5467
withFileTypes: true

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.