Skip to content

Commit 4d984ec

Browse files
Trottevanlucas
authored andcommitted
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: #10530 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 6977224 commit 4d984ec

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

test/parallel/test-stream-pipe-error-handling.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,16 @@ const Stream = require('stream').Stream;
5050
assert(removed);
5151
assert.throws(function() {
5252
w.emit('error', new Error('fail'));
53-
});
54-
}));
53+
}, /^Error: fail$/);
54+
}), 1);
5555
});
5656

5757
w.on('error', myOnError);
5858
r.pipe(w);
5959
w.removeListener('error', myOnError);
6060
removed = true;
6161

62-
function myOnError(er) {
62+
function myOnError() {
6363
throw new Error('this should not happen');
6464
}
6565
}
@@ -76,10 +76,10 @@ const Stream = require('stream').Stream;
7676
setTimeout(common.mustCall(function() {
7777
assert(removed);
7878
w.emit('error', new Error('fail'));
79-
}));
79+
}), 1);
8080
});
8181

82-
w.on('error', common.mustCall(function(er) {}));
82+
w.on('error', common.mustCall(function() {}));
8383
w._write = function() {};
8484

8585
r.pipe(w);

0 commit comments

Comments
 (0)