Skip to content
This repository has been archived by the owner on Jul 16, 2020. It is now read-only.

Commit

Permalink
fixing failing tests; updating deps to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
dominykas committed Nov 8, 2015
1 parent 68cb69b commit 4c8ebd4
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 28 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
language: node_js
sudo: false
node_js:
- "0.10"
- "0.12"
- "4"
- "5"
before_install:
- npm i -g npm
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
"test-debug": "node --debug-brk node_modules/buster/bin/buster-test"
},
"dependencies": {
"glob": ">=3.1.9",
"async": ">=0.1.22",
"lodash": "~1.0"
"glob": "5.x",
"async": "1.x",
"lodash": "3.x"
},
"devDependencies": {
"buster": "*"
Expand Down
54 changes: 29 additions & 25 deletions test/multi-glob-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,58 +57,62 @@ buster.testCase("Multi-glob", {
assert.calledWith(glob.glob, "src/buster.js");
},

"calls callback with result from glob": function () {
"calls callback with result from glob": function (done) {
var callback = this.spy();
glob.glob.yields(null, ["lib/buster.js"]);

g.glob("lib/buster.js", callback);

assert.calledOnceWith(callback, undefined, ["lib/buster.js"]);
g.glob("lib/buster.js", function (err, res) {
assert.isNull(err);
assert.equals(res, ["lib/buster.js"]);
done();
});
},

"calls callback with combined results from glob": function () {
var callback = this.spy();
"calls callback with combined results from glob": function (done) {
glob.glob.withArgs("lib/buster.js").yields(null, ["lib/buster.js"]);
var files = ["src/buster.js", "src/stuff.js"];
glob.glob.withArgs("src/*.js").yields(null, files);

g.glob(["lib/buster.js", "src/*.js"], callback);

assert.calledWith(callback, undefined,
["lib/buster.js", "src/buster.js", "src/stuff.js"]);
g.glob(["lib/buster.js", "src/*.js"], function (err, res) {
assert.isNull(err);
assert.equals(res, ["lib/buster.js", "src/buster.js", "src/stuff.js"]);
done();
});
},

"calls callback once with glob error": function () {
var callback = this.spy();
"calls callback once with glob error": function (done) {
glob.glob.withArgs("lib/buster.js").yields({ message: "Oh no" });
var files = ["src/buster.js", "src/stuff.js"];
glob.glob.withArgs("src/*.js").yields(null, files);

g.glob(["lib/buster.js", "src/*.js"], callback);

assert.calledWith(callback, { message: "Oh no" });
g.glob(["lib/buster.js", "src/*.js"], function (err) {
assert.equals(err, { message: "Oh no" });
done();
});
},

"ignore duplicated items from glob": function () {
var callback = this.spy();
"ignore duplicated items from glob": function (done) {
glob.glob.withArgs("src/foo.js").yields(null, ["src/foo.js"]);
var files = ["src/foo.js", "src/bar.js"];
glob.glob.withArgs("src/*.js").yields(null, files);

g.glob(["src/foo.js", "src/*.js"], callback);

assert.calledWith(callback, undefined, ["src/foo.js", "src/bar.js"]);
g.glob(["src/foo.js", "src/*.js"], function (err, res) {
assert.isNull(err);
assert.equals(res, ["src/foo.js", "src/bar.js"]);
done();
});
},

"strict": {
"fails on glob that matches no patterns": function () {
"fails on glob that matches no patterns": function (done) {
var callback = this.spy();
glob.glob.withArgs("src/foo.js").yields(null, []);

g.glob(["src/foo.js"], { strict: true }, callback);

assert.match(callback.args[0][0], {
message: "'src/foo.js' matched no files"
g.glob(["src/foo.js"], { strict: true }, function (err) {
assert.match(err, {
message: "'src/foo.js' matched no files"
});
done()
});
}
}
Expand Down

0 comments on commit 4c8ebd4

Please sign in to comment.