Skip to content

Commit d13bd4a

Browse files
itsmedfhinkel
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 c1dee6a commit d13bd4a

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
@@ -28,29 +28,32 @@ const fs = require('fs');
2828
const emptyFile = path.join(common.fixturesDir, 'empty.txt');
2929

3030
fs.open(emptyFile, 'r', common.mustCall((error, fd) => {
31+
3132
assert.ifError(error);
3233

33-
const read = fs.createReadStream(emptyFile, { 'fd': fd });
34+
const read = fs.createReadStream(emptyFile, { fd });
3435

3536
read.once('data', () => {
36-
throw new Error('data event should not emit');
37+
common.fail('data event should not emit');
3738
});
3839

3940
read.once('end', common.mustCall(function endEvent1() {}));
4041
}));
4142

4243
fs.open(emptyFile, 'r', common.mustCall((error, fd) => {
44+
4345
assert.ifError(error);
4446

45-
const read = fs.createReadStream(emptyFile, { 'fd': fd });
47+
const read = fs.createReadStream(emptyFile, { fd });
48+
4649
read.pause();
4750

4851
read.once('data', () => {
49-
throw new Error('data event should not emit');
52+
common.fail('data event should not emit');
5053
});
5154

5255
read.once('end', function endEvent2() {
53-
throw new Error('end event should not emit');
56+
common.fail('end event should not emit');
5457
});
5558

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

0 commit comments

Comments
 (0)