Skip to content

Commit

Permalink
test: refactor test-stream-pipe-error-handling
Browse files Browse the repository at this point in the history
* provide a RegExp for second argument to `assert.throws()`
* remove unused function arguments
* provide duration of 1 ms for `setTimeout()` calls that do not have a
  duration

PR-URL: #10530
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
Trott committed Jan 2, 2017
1 parent b465cd0 commit e5674e1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/parallel/test-stream-pipe-error-handling.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@ const Stream = require('stream').Stream;
assert(removed);
assert.throws(function() {
w.emit('error', new Error('fail'));
});
}));
}, /^Error: fail$/);
}), 1);
});

w.on('error', myOnError);
r.pipe(w);
w.removeListener('error', myOnError);
removed = true;

function myOnError(er) {
function myOnError() {
throw new Error('this should not happen');
}
}
Expand All @@ -76,10 +76,10 @@ const Stream = require('stream').Stream;
setTimeout(common.mustCall(function() {
assert(removed);
w.emit('error', new Error('fail'));
}));
}), 1);
});

w.on('error', common.mustCall(function(er) {}));
w.on('error', common.mustCall(function() {}));
w._write = function() {};

r.pipe(w);
Expand Down

0 comments on commit e5674e1

Please sign in to comment.