Moved fn skipping policy out of QueueRunner
This should allow us to more easily support complex skipping strategies like skipping nested cleanup fns when the corresponding befores were skipped, or skipping specs and suites when a beforeAll fails. * #1533
This commit is contained in:
19
src/core/CompleteOnFirstErrorSkipPolicy.js
Normal file
19
src/core/CompleteOnFirstErrorSkipPolicy.js
Normal file
@@ -0,0 +1,19 @@
|
||||
getJasmineRequireObj().CompleteOnFirstErrorSkipPolicy = function(j$) {
|
||||
function CompleteOnFirstErrorSkipPolicy(queueableFns, firstCleanupIx) {
|
||||
this.queueableFns_ = queueableFns;
|
||||
this.firstCleanupIx_ = firstCleanupIx;
|
||||
}
|
||||
|
||||
CompleteOnFirstErrorSkipPolicy.prototype.skipTo = function(
|
||||
lastRanFnIx,
|
||||
errored
|
||||
) {
|
||||
if (errored && lastRanFnIx < this.firstCleanupIx_) {
|
||||
return this.firstCleanupIx_;
|
||||
} else {
|
||||
return lastRanFnIx + 1;
|
||||
}
|
||||
};
|
||||
|
||||
return CompleteOnFirstErrorSkipPolicy;
|
||||
};
|
||||
Reference in New Issue
Block a user