Skip to content

Commit fda2a71

Browse files
author
Contra
committed
fix some tests, update deps
1 parent 96867b4 commit fda2a71

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
],
1313
"dependencies": {
1414
"duplexify": "^3.2.0",
15-
"glob-stream": "^4.0.1",
15+
"glob-stream": "^5.0.0",
1616
"glob-watcher": "^0.0.8",
1717
"graceful-fs": "^3.0.0",
1818
"merge-stream": "^0.1.7",

test/src.js

+20-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
var spies = require('./spy');
2-
var chmodSpy = spies.chmodSpy;
3-
var statSpy = spies.statSpy;
4-
51
var vfs = require('../');
62

73
var path = require('path');
@@ -53,21 +49,36 @@ describe('source stream', function() {
5349
});
5450
});
5551

52+
it('should error on file not existing', function(done) {
53+
var stream = vfs.src('./fixtures/noexist.coffee');
54+
stream.on('error', function(err){
55+
should.exist(err);
56+
done();
57+
});
58+
});
59+
5660
it('should pass through writes', function(done) {
5761
var expectedPath = path.join(__dirname, './fixtures/test.coffee');
5862
var expectedContent = fs.readFileSync(expectedPath);
59-
63+
var files = [];
6064
var expectedFile = new File({
6165
base: __dirname,
6266
cwd: __dirname,
6367
path: expectedPath,
64-
contents: expectedContent
68+
contents: expectedContent,
69+
stat: fs.lstatSync(expectedPath)
6570
});
6671

67-
var stream = vfs.src('./fixtures/noexist.coffee');
72+
var stream = vfs.src(expectedPath, {cwd: __dirname, base: __dirname});
6873
stream.on('data', function(file){
69-
file.should.equal(expectedFile);
70-
bufEqual(file.contents, expectedContent).should.equal(true);
74+
files.push(file);
75+
});
76+
stream.once('end', function(){
77+
files.length.should.equal(2);
78+
files[0].should.eql(expectedFile);
79+
bufEqual(files[0].contents, expectedContent).should.equal(true);
80+
files[1].should.eql(expectedFile);
81+
bufEqual(files[1].contents, expectedContent).should.equal(true);
7182
done();
7283
});
7384
stream.write(expectedFile);

0 commit comments

Comments
 (0)