Report start and end events for specs/suites that are skipped due to a beforeAll error

This is noisier, but it maintains compatibility with reporters that assume
(quite reasonably) that all specs and suites are either filtered out or
reported.
This commit is contained in:
Steve Gravrock
2021-12-11 12:34:23 -08:00
parent f1cf6ee419
commit 0b1385c3d3
7 changed files with 397 additions and 95 deletions

View File

@@ -25,6 +25,12 @@ getJasmineRequireObj().SkipAfterBeforeAllErrorPolicy = function(j$) {
SkipAfterBeforeAllErrorPolicy.prototype.fnErrored = function(fnIx) {
if (this.queueableFns_[fnIx].type === 'beforeAll') {
this.skipping_ = true;
// Failures need to be reported for each contained spec. But we can't do
// that from here because reporting is async. This function isn't async
// (and can't be without greatly complicating QueueRunner). Mark the
// failure so that the code that reports the suite result (which is
// already async) can detect the failure and report the specs.
this.queueableFns_[fnIx].suite.hadBeforeAllFailure = true;
}
};