caolan/async — pull request #663 by Mickael-van-der-Beek (2014-11-18 20:40:58+00:00)
Title: Detecting dead-locks in async.auto() and throwing an Error

This pull request adds dead-lock detection in ```async.auto()``` due to dependencies and thus fixes caolan/async#263.

The three dead-lock cases that were handled and for which test cases were added are:

- 1. inexistant dependency; e.g:
```
async.auto({
task1: ['noexist', function(callback, results){
callback(null, 'task1');
}]
});
```
- 2. cyclic dependencies; e.g:
```
async.auto({
task1: ['task2', function(callback, results){
callback(null, 'task1');
}],
task2: ['task1', function(callback, results){
callback(null, 'task2');
}]
});
```
- 3. self as dependency which is a subcase of ```2.```; e.g:
```
async.auto({
task1: ['task1', function(callback, results){
callback(null, 'task1');
}]
});
```

If any of these cases is encountered, a verbose `Error()` is thrown.

It is possible to improve the performance a little further by embedding these detections inside the ```ready()``` method:

[Mickael-van-der-Beek/async@2410077e26d5429ac45533438f008706dcb989f7/lib/async.js#L492](https://github.com/Mickael-van-der-Beek/async/blob/2410077e26d5429ac45533438f008706dcb989f7/lib/async.js#L492)

but I felt that it would be a dirtier solution.
If you prefer the faster solution though, just ask and I'll create a new pull-request for it.