node/test/parallel/test-stream-pipe-error-unhandled.js
Robert Nagy f8f6a21580 stream: throw unhandled error for readable with autoDestroy
If autoDestroy then we should still throw on unhandled
errors.

PR-URL: https://github.com/nodejs/node/pull/29806
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Co-Authored-By: Trivikram Kamat <trivikr.dev@gmail.com>
2019-10-13 16:38:15 -07:00

22 lines
413 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const { Readable, Writable } = require('stream');
process.on('uncaughtException', common.mustCall((err) => {
assert.strictEqual(err.message, 'asd');
}));
const r = new Readable({
read() {
this.push('asd');
}
});
const w = new Writable({
autoDestroy: true,
write() {}
});
r.pipe(w);
w.destroy(new Error('asd'));