Add explicit fail and move on for async functions
- `done` now has a `fail` property which will call the global `fail` then continue to the next function in the queue [finish #73744618] Fix #567 Fix #568
This commit is contained in:
@@ -18,6 +18,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
||||
this.catchException = attrs.catchException || function() { return true; };
|
||||
this.userContext = attrs.userContext || {};
|
||||
this.timer = attrs.timeout || {setTimeout: setTimeout, clearTimeout: clearTimeout};
|
||||
this.fail = attrs.fail || function() {};
|
||||
}
|
||||
|
||||
QueueRunner.prototype.execute = function() {
|
||||
@@ -63,6 +64,11 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
||||
}),
|
||||
timeoutId;
|
||||
|
||||
next.fail = function() {
|
||||
self.fail.apply(null, arguments);
|
||||
next();
|
||||
};
|
||||
|
||||
if (queueableFn.timeout) {
|
||||
timeoutId = Function.prototype.apply.apply(self.timer.setTimeout, [j$.getGlobal(), [function() {
|
||||
var error = new Error('Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.');
|
||||
|
||||
Reference in New Issue
Block a user