Skip to content

Commit

Permalink
Update: Switch to ordered-read-streams to stream files in glob order (c…
Browse files Browse the repository at this point in the history
…loses #7)
  • Loading branch information
armed authored and phated committed Feb 21, 2017
1 parent 2deb83a commit f1cef6c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

var through = require('through');
var map = require('map-stream');
var Combine = require('combine-stream');
var Combine = require('ordered-read-streams');
var unique = require('unique-stream');

var glob = require('glob');
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dependencies": {
"glob": "~3.2.7",
"minimatch": "~0.2.12",
"combine-stream": "0.0.4",
"ordered-read-streams": "~0.0.3",
"glob2base": "~0.0.4",
"unique-stream": "~0.0.3",
"through": "~2.3.4",
Expand Down
24 changes: 24 additions & 0 deletions test/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,30 @@ describe('glob-stream', function() {
});
});

it('should return a correctly ordered file name stream for three globs with globstars', function(done) {
var globArray = [
join(__dirname, "./fixtures/**/test.txt"),
join(__dirname, "./fixtures/**/test.coffee"),
join(__dirname, "./fixtures/**/test.js")
];
var stream = gs.create(globArray, {cwd: __dirname});

var files = [];
stream.on('error', done);
stream.on('data', function(file) {
should.exist(file);
should.exist(file.path);
files.push(file);
});
stream.on('end', function() {
files.length.should.equal(3);
path.basename(files[0].path).should.equal('test.txt');
path.basename(files[1].path).should.equal('test.coffee');
path.basename(files[2].path).should.equal('test.js');
done();
});
});

it('should return a correctly ordered file name stream for two globs', function(done) {
var globArray = [
join(__dirname, "./fixtures/whatsgoingon/hey/isaidhey/whatsgoingon/test.txt"),
Expand Down

0 comments on commit f1cef6c

Please # to comment.