Skip to content

Commit

Permalink
Merge github.com:wearefractal/vinyl-fs
Browse files Browse the repository at this point in the history
  • Loading branch information
tunnckoCore committed Mar 31, 2015
2 parents 5d9f058 + 30f2ff2 commit 1a788e8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -12,8 +12,8 @@
],
"dependencies": {
"duplexify": "^3.2.0",
"glob-stream": "^4.0.1",
"glob-watcher": "^0.0.8",
"glob-stream": "^5.0.0",
"glob-watcher": "^2.0.0",
"graceful-fs": "^3.0.0",
"merge-stream": "^0.1.7",
"mkdirp": "^0.5.0",
Expand Down
1 change: 0 additions & 1 deletion test/dest.js
Expand Up @@ -743,7 +743,6 @@ describe('dest stream', function() {
var onEnd = function(){
expectedCount.should.equal(1);
should(chmodSpy.called).be.not.ok;
realMode(fs.lstatSync(expectedPath).mode).should.equal(expectedMode);
done();
};

Expand Down
29 changes: 20 additions & 9 deletions test/src.js
@@ -1,7 +1,3 @@
var spies = require('./spy');
var chmodSpy = spies.chmodSpy;
var statSpy = spies.statSpy;

var vfs = require('../');

var path = require('path');
Expand Down Expand Up @@ -53,21 +49,36 @@ describe('source stream', function() {
});
});

it('should error on file not existing', function(done) {
var stream = vfs.src('./fixtures/noexist.coffee');
stream.on('error', function(err){
should.exist(err);
done();
});
});

it('should pass through writes', function(done) {
var expectedPath = path.join(__dirname, './fixtures/test.coffee');
var expectedContent = fs.readFileSync(expectedPath);

var files = [];
var expectedFile = new File({
base: __dirname,
cwd: __dirname,
path: expectedPath,
contents: expectedContent
contents: expectedContent,
stat: fs.lstatSync(expectedPath)
});

var stream = vfs.src('./fixtures/noexist.coffee');
var stream = vfs.src(expectedPath, {cwd: __dirname, base: __dirname});
stream.on('data', function(file){
file.should.equal(expectedFile);
bufEqual(file.contents, expectedContent).should.equal(true);
files.push(file);
});
stream.once('end', function(){
files.length.should.equal(2);
files[0].should.eql(expectedFile);
bufEqual(files[0].contents, expectedContent).should.equal(true);
files[1].should.eql(expectedFile);
bufEqual(files[1].contents, expectedContent).should.equal(true);
done();
});
stream.write(expectedFile);
Expand Down

0 comments on commit 1a788e8

Please sign in to comment.