From 3803e0892e6ea9c0372ccdd7467d703922c0cf50 Mon Sep 17 00:00:00 2001 From: Ilya Shatokhin Date: Mon, 30 Nov 2015 10:22:05 -0200 Subject: [PATCH 1/2] Fixed incorrect handling of arguments in "auto" in case of empty callback --- lib/async.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/async.js b/lib/async.js index 08af69396..3748ac070 100644 --- a/lib/async.js +++ b/lib/async.js @@ -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; From c744ab6ac21971b806073f44ab51e150f23bfd2b Mon Sep 17 00:00:00 2001 From: Ilya Shatokhin Date: Thu, 3 Dec 2015 09:48:37 -0200 Subject: [PATCH 2/2] Added test for auto with concurrency but without callback. --- test/test-async.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/test-async.js b/test/test-async.js index 6cce049d5..ee0b950d6 100755 --- a/test/test-async.js +++ b/test/test-async.js @@ -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'"); @@ -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){