mirror of
https://github.com/nodejs/node.git
synced 2026-12-06 06:38:45 -05:00
This PR adds _readableState.errorEmitted and add the tracking of it. Fixes: https://github.com/nodejs/node/issues/6083 PR-URL: https://github.com/nodejs/node/pull/20104 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
25 lines
506 B
JavaScript
25 lines
506 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const { Duplex } = require('stream');
|
|
const { strictEqual } = require('assert');
|
|
|
|
const duplex = new Duplex({
|
|
write(chunk, enc, cb) {
|
|
cb(new Error('kaboom'));
|
|
},
|
|
read() {
|
|
this.push(null);
|
|
}
|
|
});
|
|
|
|
duplex.on('error', common.mustCall(function() {
|
|
strictEqual(this._readableState.errorEmitted, true);
|
|
strictEqual(this._writableState.errorEmitted, true);
|
|
}));
|
|
|
|
duplex.on('end', common.mustNotCall());
|
|
|
|
duplex.end('hello');
|
|
duplex.resume();
|