diff --git a/test/parallel/test-stream-pipe-error-handling.js b/test/parallel/test-stream-pipe-error-handling.js index ea10de14b8240f..cf3a3699d0975d 100644 --- a/test/parallel/test-stream-pipe-error-handling.js +++ b/test/parallel/test-stream-pipe-error-handling.js @@ -110,12 +110,15 @@ const { Stream, PassThrough } = require('stream'); } { + const _err = new Error('this should be handled'); const destination = new PassThrough(); - destination.once('error', common.mustCall()); + destination.once('error', common.mustCall((err) => { + assert.strictEqual(err, _err); + })); const stream = new Stream(); stream .pipe(destination); - destination.destroy(new Error('this should be handled')); + destination.destroy(_err); }