Skip to content

Commit d112aad

Browse 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 <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Italo A. Casas <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]>
1 parent 126dcb7 commit d112aad

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

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

+8-5
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)