gulpjs / vinyl

Virtual file format.
MIT License
1.28k stars 105 forks source link

use v2.0.1 fails in contents set function #124

Closed Tommassissimo closed 7 years ago

Tommassissimo commented 7 years ago

I use vinyl & event-stream & mocha to test my gulp plugin. Everything works fine with version v1.2.0 and it fails in v2.0.1(latest version)

Here is my sample Code:

     var es = require('event-stream');
     var File = require('vinyl');
      var stream = es.readArray(['I am a body'])
      var fakeFile = new File({
        contents: stream
      });

And it throw out TypeError as following:

TypeError: Cannot read property 'objectMode' of undefined
    at new Cloneable (node_modules/cloneable-readable/index.js:13:41)
    at Cloneable (node_modules/cloneable-readable/index.js:10:12)
    at File.Object.defineProperty.set (node_modules/vinyl/index.js:183:13)
    at new File (node_modules/vinyl/index.js:33:17)
    at Context.<anonymous> (test/index.js:18:22)
phated commented 7 years ago

event-stream is an unsupported module because they either use Streams1 or create fake streams that aren't up to spec. You probably want to use the from2 module.