mirror of
https://github.com/nodejs/node.git
synced 2024-11-24 12:10:08 +01:00
bdea725bdc
Fix: https://github.com/nodejs/node/issues/26550 PR-URL: https://github.com/nodejs/node/pull/26691 Fixes: https://github.com/false Fixes: https://github.com/nodejs/node/issues/26550 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
32 lines
578 B
JavaScript
32 lines
578 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const { Transform, Readable, pipeline } = require('stream');
|
|
const assert = require('assert');
|
|
|
|
const reader = new Readable({
|
|
read(size) { this.push('foo'); }
|
|
});
|
|
|
|
let count = 0;
|
|
|
|
const err = new Error('this-error-gets-hidden');
|
|
|
|
const transform = new Transform({
|
|
transform(chunk, enc, cb) {
|
|
if (count++ >= 5)
|
|
this.emit('error', err);
|
|
else
|
|
cb(null, count.toString() + '\n');
|
|
}
|
|
});
|
|
|
|
pipeline(
|
|
reader,
|
|
transform,
|
|
process.stdout,
|
|
common.mustCall((e) => {
|
|
assert.strictEqual(e, err);
|
|
})
|
|
);
|