nodeunit icon indicating copy to clipboard operation
nodeunit copied to clipboard

Double hash stream read causes test to fail

Open Ayjay opened this issue 12 years ago • 0 comments

When I run nodeunit on the following code:

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.

Ayjay avatar May 18 '13 01:05 Ayjay