diff options
author | Alexander Early <alexander.early@gmail.com> | 2015-12-03 12:05:11 -0800 |
---|---|---|
committer | Alexander Early <alexander.early@gmail.com> | 2015-12-03 12:05:11 -0800 |
commit | f9f62043460e16db0f5bf42045228db150590171 (patch) | |
tree | 4fe0a91d2c9b3f93f4b765a4adce3e33d51bcb2f | |
parent | 0c60dedb47073a149f9bb52057563b20857eabfd (diff) | |
parent | c744ab6ac21971b806073f44ab51e150f23bfd2b (diff) | |
download | async-f9f62043460e16db0f5bf42045228db150590171.tar.gz |
Merge pull request #966 from ex1st/master
Incorrect handling of arguments in "auto" in case of empty callback
-rw-r--r-- | lib/async.js | 2 | ||||
-rwxr-xr-x | test/test-async.js | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/async.js b/lib/async.js index 08af693..3748ac0 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; diff --git a/test/test-async.js b/test/test-async.js index 6cce049..ee0b950 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){ |