QueueRunner continues running functions in async case

Continue running functions even if an async spec throws an
exception during the synchronous portion of the spec
This commit is contained in:
Sheel Choksi
2013-07-07 21:00:07 -07:00
parent 7f6b16ccf2
commit ec7d58fce0
3 changed files with 26 additions and 4 deletions

View File

@@ -20,10 +20,13 @@ getJasmineRequireObj().QueueRunner = function() {
for(iterativeIndex = recursiveIndex; iterativeIndex < length; iterativeIndex++) {
var fn = fns[iterativeIndex];
if (fn.length > 0) {
attempt(function() {
var attemptSuccessful = attempt(function() {
fn.call(self, function() { self.run(fns, iterativeIndex + 1); });
});
return;
if(attemptSuccessful) {
return;
}
} else {
attempt(function() { fn.call(self); });
}
@@ -41,6 +44,7 @@ getJasmineRequireObj().QueueRunner = function() {
function attempt(fn) {
try {
fn();
return true;
} catch (e) {
self.onException(e);
if (!self.catchException(e)) {
@@ -48,6 +52,7 @@ getJasmineRequireObj().QueueRunner = function() {
//use a finally block to close the loop in a nice way..
throw e;
}
return false;
}
}
};