Permalink
Browse files

updated registry tests

  • Loading branch information...
2 parents d94121b + 0e73095 commit b979f9b8cbbcb5f41ef388a1efc2cd178177058e @twobit committed Dec 12, 2012
Showing with 46 additions and 8 deletions.
  1. +6 −0 build/gear.js
  2. +1 −1 build/gear.min.js
  3. +3 −3 package.json
  4. +3 −0 test/fixtures/test-tasks/index.js
  5. +33 −4 test/registry.js
View
@@ -3212,6 +3212,8 @@ Registry.prototype = {
if (options.tasks) {
this._loadTasks(options.tasks);
}
+
+ return this;
},
_loadModule: function(name) {
@@ -3360,6 +3362,10 @@ Queue.prototype._dispatch = function(name, options, blobs, done) {
case 'map': // Task transforms one blob at a time
async.map(blobs, task.bind(this, options), doneWrap);
break;
+
+ case 'syncmap': // Task transforms one blob at a time until done is called.
+ async.mapSeries(blobs, task.bind(this, options), doneWrap);
+ break;
case 'reduce': // Merges blobs from left to right
async.reduce(blobs, new Blob(), task.bind(this, options), function(err, results) {
View
Oops, something went wrong.
View
@@ -1,6 +1,6 @@
{
"name": "gear",
- "version": "0.8.2",
+ "version": "0.8.3",
"description": "Gear.js - Build System for Node.js and the Browser",
"author": "Stephen Murphy <stephen@hypernaut.com>",
"keywords": ["task", "build"],
@@ -16,8 +16,8 @@
"mkdirp": "0.3.x"
},
"devDependencies": {
- "should": "0.6.x",
- "mocha": "1.0.x",
+ "should": "1.2.x",
+ "mocha": "1.7.x",
"gear-lib": ">= 0.8.x"
}
}
@@ -0,0 +1,3 @@
+exports.fooga = function(dummy, blob, done) {
+ done(null, blob);
+};
View
@@ -1,11 +1,40 @@
-var Registry = require('../lib/registry').Registry;
+var Registry = require('../lib/registry').Registry,
+ path = require('path'),
+ fixtures = {
+ dirname: path.join(process.cwd(), "test/fixtures/test-tasks"),
+ filename: path.join(process.cwd(), "test/fixtures/test-tasks/index.js")
+ };
describe('Registry', function() {
describe('load()', function() {
- it('should load modules');
- it('should load directories');
- it('should load files');
+ it('should load modules', function() {
+ var registry = new Registry();
+
+ registry.load({module: 'gear-lib'});
+
+ registry.tasks.should.include('csslint');
+ registry.tasks.should.include('jslint');
+ registry.tasks.should.include('s3');
+ registry.tasks.should.include('glob');
+ });
+ it('should load directories', function() {
+ var registry = new Registry();
+
+ registry.load({dirname: fixtures.dirname});
+
+ registry.tasks.should.include('fooga');
+ });
+
+
+ it('should load files', function() {
+ var registry = new Registry();
+
+ registry.load({filename: fixtures.filename});
+
+ registry.tasks.should.include('fooga');
+ });
+
it('should allow for chaining #load', function() {
var registry = new Registry();

0 comments on commit b979f9b

Please sign in to comment.