Skip everything except afterAll fns when a beforeAll fn errors

* Fixes #1533
This commit is contained in:
Steve Gravrock
2021-09-30 10:19:58 -07:00
parent 5eaeeb0b6c
commit 5f1ef5ac2b
14 changed files with 316 additions and 70 deletions

View File

@@ -0,0 +1,32 @@
getJasmineRequireObj().SkipAfterBeforeAllErrorPolicy = function(j$) {
function SkipAfterBeforeAllErrorPolicy(queueableFns, firstCleanupIx) {
this.queueableFns_ = queueableFns;
this.skipping_ = false;
}
SkipAfterBeforeAllErrorPolicy.prototype.skipTo = function(lastRanFnIx) {
if (this.skipping_) {
return this.nextAfterAllAfter_(lastRanFnIx);
} else {
return lastRanFnIx + 1;
}
};
SkipAfterBeforeAllErrorPolicy.prototype.nextAfterAllAfter_ = function(i) {
for (
i++;
i < this.queueableFns_.length &&
this.queueableFns_[i].type !== 'afterAll';
i++
) {}
return i;
};
SkipAfterBeforeAllErrorPolicy.prototype.fnErrored = function(fnIx) {
if (this.queueableFns_[fnIx].type === 'beforeAll') {
this.skipping_ = true;
}
};
return SkipAfterBeforeAllErrorPolicy;
};