Different behaviour between node 8 and 10
- Dominant language
- JavaScript
- Stars
- 252
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
For some reason when an `error` is emitted on stream in node 8 this is propagated correctly and followed by `end` event, however on node 10, this happens in reverse order. (using latest 2.0.1 version of pumpify)
Example:
```javascript
'use strict';
const { PassThrough, Writable } = require('stream');
const pumpify = require('pumpify');
const stream1 = new PassThrough();
const stream2 = new Writable();
const combined = pumpify(stream1, stream2);
combined.on('end', () => {
console.log('Stream end');
});
combined.on('error', e => {
console.log('Stream error: ', e);
});
stream1.emit('error', 'aaa');
```
```console
nvm use 8
Now using node v8.17.0 (npm v6.13.4)
node tmp.js
Stream error: aaa
Stream end
```
```console
nvm use 10
Now using node v10.19.0 (npm v6.13.4)
node tmp.js
Stream end
Stream error: aaa
```
Notice the reverse order of events.
Is this expected behaviour? Am I doing something wrong?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the provided tmp.js reproduction and run it against pumpify 2.0.1 under Node 8.17.0 and Node 10.19.0. Compare the emitted event order and determine whether the version difference is expected behavior or a pumpify bug.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100