From 32b4ce66880d0fae5d26e7d144e1c204ec1e4a57 Mon Sep 17 00:00:00 2001 From: Alexander Early Date: Sun, 31 May 2015 20:36:27 -0700 Subject: [PATCH] add test for #557, #558 --- CHANGELOG.md | 3 ++- test/test-async.js | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc023fb0d..eabdf28e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,10 +11,11 @@ New Features: Bug Fixes: - `forever` will no longer stack overflow with a synchronous iterator (#622) -- `eachLimit` and others limit functions will stop iterating once an error occurs (#754) +- `eachLimit` and other limit functions will stop iterating once an error occurs (#754) - Always pass `null` in callbacks when there is no error (#439) - Ensure proper conditions when calling `drain()` after pushing an empty data set to a queue (#668) - `each` and family will properly handle an empty array (#578) +- `eachSeries` and family will finish if the underlying array is modified during execution (#557) - Doc fixes (#766) diff --git a/test/test-async.js b/test/test-async.js index 5b60195e3..2f5144304 100755 --- a/test/test-async.js +++ b/test/test-async.js @@ -1427,6 +1427,21 @@ exports['eachSeries empty array'] = function(test){ setTimeout(test.done, 25); }; +exports['eachSeries array modification'] = function(test) { + test.expect(1); + var arr = [1, 2, 3, 4]; + async.eachSeries(arr, function (x, callback) { + async.setImmediate(callback); + }, function () { + test.ok(true, 'should call callback'); + }); + + arr.pop(); + arr.splice(0, 1); + + setTimeout(test.done, 25); +}; + exports['eachSeries error'] = function(test){ test.expect(2); var call_order = [];