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 cddc32c

Browse filesBrowse files
itsmedMylesBorins
authored andcommitted
test: replace throw with common.fail
Replace anonymous functions with arrow functions. Replace throw new Error with common.fail. PR-URL: #9700 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
1 parent f23377c commit cddc32c
Copy full SHA for cddc32c

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

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

‎test/parallel/test-fs-empty-readStream.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-fs-empty-readStream.js
+8-5Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,32 @@ const fs = require('fs');
77
const emptyFile = path.join(common.fixturesDir, 'empty.txt');
88

99
fs.open(emptyFile, 'r', common.mustCall((error, fd) => {
10+
1011
assert.ifError(error);
1112

12-
const read = fs.createReadStream(emptyFile, { 'fd': fd });
13+
const read = fs.createReadStream(emptyFile, { fd });
1314

1415
read.once('data', () => {
15-
throw new Error('data event should not emit');
16+
common.fail('data event should not emit');
1617
});
1718

1819
read.once('end', common.mustCall(function endEvent1() {}));
1920
}));
2021

2122
fs.open(emptyFile, 'r', common.mustCall((error, fd) => {
23+
2224
assert.ifError(error);
2325

24-
const read = fs.createReadStream(emptyFile, { 'fd': fd });
26+
const read = fs.createReadStream(emptyFile, { fd });
27+
2528
read.pause();
2629

2730
read.once('data', () => {
28-
throw new Error('data event should not emit');
31+
common.fail('data event should not emit');
2932
});
3033

3134
read.once('end', function endEvent2() {
32-
throw new Error('end event should not emit');
35+
common.fail('end event should not emit');
3336
});
3437

3538
setTimeout(common.mustCall(() => {

0 commit comments

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