From d112aad78bcc792e184a344bf93f04d7a9dc2222 Mon Sep 17 00:00:00 2001 From: "Dejon \"DJ\" Gill" Date: Sat, 19 Nov 2016 14:31:17 -0800 Subject: [PATCH] test: replace throw with common.fail Replace anonymous functions with arrow functions. Replace throw new Error with common.fail. PR-URL: https://github.com/nodejs/node/pull/9700 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Italo A. Casas Reviewed-By: Franziska Hinkelmann --- test/parallel/test-fs-empty-readStream.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-fs-empty-readStream.js b/test/parallel/test-fs-empty-readStream.js index 858d07e4f0b982..cc09517590cdc7 100644 --- a/test/parallel/test-fs-empty-readStream.js +++ b/test/parallel/test-fs-empty-readStream.js @@ -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(() => {