Multiple end() calls should throw an error
- Dominant language
- JavaScript
- Stars
- 239
- Forks
- 27
- Avg merge
- 27m
- Merged PRs (30d)
- 1
Description
The following test currently fails:
```javascript
tape('repeat calls to .end() should cause an error', function (t) {
t.plan(4)
const s = new Writable({
write (data, cb) {
t.equals(data, 'a')
cb()
}
})
s.on('error', function () {
t.pass('Error called by multiple end calls')
})
s.on('close', function () {
t.end()
})
t.equals(s.writable, true)
s.end('a')
t.equals(s.writable, false)
s.end('b')
}
```
For one, the write method is called for both `end()` calls and there is no error caused when this is executed.
I noted this as incompatibility to the current Node.js streams and am wondering: is that intentional? should that be documented?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the failing JavaScript test shown in the issue and trace the Writable entry point used by s.end(). Reproduce the two end() calls, then compare the observed write, error, and close events with the intended Node.js stream behavior. Done means the compatibility decision is resolved and the behavior is either corrected with coverage or documented as intentional.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100