Skip to content

Commit

Permalink
Merge pull request caolan#966 from ex1st/master
Browse files Browse the repository at this point in the history
Incorrect handling of arguments in "auto" in case of empty callback
  • Loading branch information
aearly committed Dec 3, 2015
2 parents 0c60ded + c744ab6 commit f9f6204
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@
};

async.auto = function (tasks, concurrency, callback) {
if (!callback) {
if (typeof arguments[1] === 'function') {
// concurrency is optional, shift the args.
callback = concurrency;
concurrency = null;
Expand Down
8 changes: 7 additions & 1 deletion test/test-async.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,6 @@ exports['auto results'] = function(test){
});
};


exports['auto empty object'] = function(test){
async.auto({}, function(err){
test.ok(err === null, err + " passed instead of 'null'");
Expand Down Expand Up @@ -461,6 +460,13 @@ exports['auto no callback'] = function(test){
});
};

exports['auto concurrency no callback'] = function(test){
async.auto({
task1: function(callback){callback();},
task2: ['task1', function(callback){callback(); test.done();}]
}, 1);
};

exports['auto error should pass partial results'] = function(test) {
async.auto({
task1: function(callback){
Expand Down

0 comments on commit f9f6204

Please sign in to comment.