Skip everything except afterAll fns when a beforeAll fn errors
* Fixes #1533
This commit is contained in:
32
src/core/SkipAfterBeforeAllErrorPolicy.js
Normal file
32
src/core/SkipAfterBeforeAllErrorPolicy.js
Normal 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;
|
||||
};
|
||||
Reference in New Issue
Block a user