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 3e39909

Browse filesBrowse files
teorossi82targos
authored andcommitted
test: add cb error test for fs.close()
Provides some missing test coverage. PR-URL: #29970 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent b57fe3b commit 3e39909
Copy full SHA for 3e39909

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

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

‎test/parallel/test-fs-close-errors.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-fs-close-errors.js
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,19 @@ const fs = require('fs');
1717
assert.throws(() => fs.close(input), errObj);
1818
assert.throws(() => fs.closeSync(input), errObj);
1919
});
20+
21+
{
22+
// Test error when cb is not a function
23+
const fd = fs.openSync(__filename, 'r');
24+
25+
const errObj = {
26+
code: 'ERR_INVALID_CALLBACK',
27+
name: 'TypeError'
28+
};
29+
30+
['', false, null, {}, []].forEach((input) => {
31+
assert.throws(() => fs.close(fd, input), errObj);
32+
});
33+
34+
fs.closeSync(fd);
35+
}

0 commit comments

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