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:
Steve Gravrock
2021-09-29 12:14:07 -07:00
parent 457a2727ba
commit 5eaeeb0b6c
8 changed files with 228 additions and 57 deletions

View 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;
};