Skip to content

Commit

Permalink
test: replace throw with common.fail
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
itsmed authored and MylesBorins committed Mar 28, 2017
1 parent 126dcb7 commit d112aad
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions test/parallel/test-fs-empty-readStream.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,32 @@ const fs = require('fs');
const emptyFile = path.join(common.fixturesDir, 'empty.txt');

fs.open(emptyFile, 'r', common.mustCall((error, fd) => {

assert.ifError(error);

const read = fs.createReadStream(emptyFile, { 'fd': fd });
const read = fs.createReadStream(emptyFile, { fd });

read.once('data', () => {
throw new Error('data event should not emit');
common.fail('data event should not emit');
});

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

fs.open(emptyFile, 'r', common.mustCall((error, fd) => {

assert.ifError(error);

const read = fs.createReadStream(emptyFile, { 'fd': fd });
const read = fs.createReadStream(emptyFile, { fd });

read.pause();

read.once('data', () => {
throw new Error('data event should not emit');
common.fail('data event should not emit');
});

read.once('end', function endEvent2() {
throw new Error('end event should not emit');
common.fail('end event should not emit');
});

setTimeout(common.mustCall(() => {
Expand Down

0 comments on commit d112aad

Please sign in to comment.