diff options
author | Rich Trott <rtrott@gmail.com> | 2016-12-29 21:19:36 -0800 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2017-01-01 21:10:45 -0800 |
commit | e5674e1c046518fc3788ed1df6aea11b588f440e (patch) | |
tree | 248fa18340250930048903dfee577fc1fb236f37 /test/parallel/test-stream-pipe-error-handling.js | |
parent | b465cd07fee443ef23b55d05b838379b4069bfa4 (diff) | |
download | android-node-v8-e5674e1c046518fc3788ed1df6aea11b588f440e.tar.gz android-node-v8-e5674e1c046518fc3788ed1df6aea11b588f440e.tar.bz2 android-node-v8-e5674e1c046518fc3788ed1df6aea11b588f440e.zip |
test: refactor test-stream-pipe-error-handling
* 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: https://github.com/nodejs/node/pull/10530
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'test/parallel/test-stream-pipe-error-handling.js')
-rw-r--r-- | test/parallel/test-stream-pipe-error-handling.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/test/parallel/test-stream-pipe-error-handling.js b/test/parallel/test-stream-pipe-error-handling.js index 3b36768805..db79f6e5f3 100644 --- a/test/parallel/test-stream-pipe-error-handling.js +++ b/test/parallel/test-stream-pipe-error-handling.js @@ -50,8 +50,8 @@ const Stream = require('stream').Stream; assert(removed); assert.throws(function() { w.emit('error', new Error('fail')); - }); - })); + }, /^Error: fail$/); + }), 1); }); w.on('error', myOnError); @@ -59,7 +59,7 @@ const Stream = require('stream').Stream; w.removeListener('error', myOnError); removed = true; - function myOnError(er) { + function myOnError() { throw new Error('this should not happen'); } } @@ -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); |