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 c8db047

Browse filesBrowse files
Trottaddaleax
authored andcommitted
test: refactor test-fs-read-*
* Use `common.mustNotCall()` in place of `common.noop` where appropriate * Increase specificity of regular expressions (that is, make them match the whole error string rather than part of the error string) in `assert.throws()` calls PR-URL: #13501 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
1 parent bf61d97 commit c8db047
Copy full SHA for c8db047

File tree

Expand file treeCollapse file tree

2 files changed

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

2 files changed

+5
-5
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-fs-read-file-assert-encoding.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-fs-read-file-assert-encoding.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ const encoding = 'foo-8';
88
const filename = 'bar.txt';
99

1010
assert.throws(
11-
fs.readFile.bind(fs, filename, { encoding }, common.noop),
12-
new RegExp(`Error: Unknown encoding: ${encoding}$`)
11+
fs.readFile.bind(fs, filename, { encoding }, common.mustNotCall()),
12+
new RegExp(`^Error: Unknown encoding: ${encoding}$`)
1313
);
Collapse file

‎test/parallel/test-fs-read-type.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-fs-read-type.js
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ assert.throws(() => {
1313
expected.length,
1414
0,
1515
'utf-8',
16-
common.noop);
17-
}, /Second argument needs to be a buffer/);
16+
common.mustNotCall());
17+
}, /^TypeError: Second argument needs to be a buffer$/);
1818

1919
assert.throws(() => {
2020
fs.readSync(fd, expected.length, 0, 'utf-8');
21-
}, /Second argument needs to be a buffer/);
21+
}, /^TypeError: Second argument needs to be a buffer$/);

0 commit comments

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