Double hash stream read causes test to fail
- Dominant language
- JavaScript
- Stars
- 1.9k
- Forks
- 359
- PR merge metrics
- No merged PRs in 30d
Description
When I run nodeunit on the following code:
``` javascript
var crypto = require('crypto');
exports.wtf = function(test) {
var hash1 = crypto.createHash('sha256');
var hash2 = crypto.createHash('sha256');
hash2.on('readable', function() {
hash2.read(4); // comment this line and test passes
test.done();
});
hash1.pipe(hash2);
hash1.end(new Buffer(1000));
};
```
it fails with the error "TypeError: Cannot read property'setup' of undefined". If I comment out the indicated line, the test passes.
This is with node v0.10.6 and nodeunit 0.8.0 on Windows 8.
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the provided nodeunit 0.8.0 example with Node v0.10.6, comparing the failing hash2.read(4) case with the passing version. Start by tracing how nodeunit handles test.done() during the readable callback and identify the source of the "setup" TypeError. Done means the reproduction no longer fails while preserving the existing passing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100