Encapsulate suite result
This commit is contained in:
@@ -9631,6 +9631,7 @@ getJasmineRequireObj().Runner = function(j$) {
|
||||
overallStatus = 'passed';
|
||||
}
|
||||
|
||||
const topSuiteResult = this.#topSuite.doneEvent();
|
||||
/**
|
||||
* Information passed to the {@link Reporter#jasmineDone} event.
|
||||
* @typedef JasmineDoneInfo
|
||||
@@ -9650,8 +9651,8 @@ getJasmineRequireObj().Runner = function(j$) {
|
||||
incompleteReason: incompleteReason,
|
||||
incompleteCode: incompleteCode,
|
||||
order: orderForReporting(order),
|
||||
failedExpectations: this.#topSuite.result.failedExpectations,
|
||||
deprecationWarnings: this.#topSuite.result.deprecationWarnings
|
||||
failedExpectations: topSuiteResult.failedExpectations,
|
||||
deprecationWarnings: topSuiteResult.deprecationWarnings
|
||||
};
|
||||
this.#topSuite.reportedDone = true;
|
||||
await this.#reportDispatcher.jasmineDone(jasmineDoneInfo);
|
||||
@@ -10615,6 +10616,7 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
#throwOnExpectationFailure;
|
||||
#autoCleanClosures;
|
||||
#timer;
|
||||
#result;
|
||||
|
||||
constructor(attrs) {
|
||||
this.id = attrs.id;
|
||||
@@ -10647,8 +10649,8 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
// Throw a better one now.
|
||||
j$.private.util.assertReporterCloneable(key, 'Key');
|
||||
j$.private.util.assertReporterCloneable(value, 'Value');
|
||||
this.result.properties = this.result.properties || {};
|
||||
this.result.properties[key] = value;
|
||||
this.#result.properties = this.#result.properties || {};
|
||||
this.#result.properties[key] = value;
|
||||
}
|
||||
|
||||
getFullName() {
|
||||
@@ -10698,7 +10700,7 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
}
|
||||
|
||||
endTimer() {
|
||||
this.result.duration = this.#timer.elapsed();
|
||||
this.#result.duration = this.#timer.elapsed();
|
||||
}
|
||||
|
||||
cleanupBeforeAfter() {
|
||||
@@ -10711,7 +10713,7 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.result = {
|
||||
this.#result = {
|
||||
id: this.id,
|
||||
description: this.description,
|
||||
fullName: this.getFullName(),
|
||||
@@ -10779,7 +10781,7 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
];
|
||||
|
||||
for (const k of toCopy) {
|
||||
event[k] = this.result[k];
|
||||
event[k] = this.#result[k];
|
||||
}
|
||||
|
||||
return event;
|
||||
@@ -10808,7 +10810,7 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
return 'pending';
|
||||
}
|
||||
|
||||
if (this.result.failedExpectations.length > 0) {
|
||||
if (this.#result.failedExpectations.length > 0) {
|
||||
return 'failed';
|
||||
} else {
|
||||
return 'passed';
|
||||
@@ -10816,12 +10818,7 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
}
|
||||
|
||||
hasOwnFailedExpectations() {
|
||||
return this.result.failedExpectations.length > 0;
|
||||
}
|
||||
|
||||
getResult() {
|
||||
this.result.status = this.#status();
|
||||
return this.result;
|
||||
return this.#result.failedExpectations.length > 0;
|
||||
}
|
||||
|
||||
sharedUserContext() {
|
||||
@@ -10857,7 +10854,7 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
if (this.reportedDone) {
|
||||
this.onLateError(failedExpectation);
|
||||
} else {
|
||||
this.result.failedExpectations.push(failedExpectation);
|
||||
this.#result.failedExpectations.push(failedExpectation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10895,12 +10892,7 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
if (this.reportedDone) {
|
||||
this.onLateError(expectationResult);
|
||||
} else {
|
||||
this.result.failedExpectations.push(expectationResult);
|
||||
|
||||
// TODO: refactor so that we don't need to override cached status
|
||||
if (this.result.status) {
|
||||
this.result.status = 'failed';
|
||||
}
|
||||
this.#result.failedExpectations.push(expectationResult);
|
||||
}
|
||||
|
||||
if (this.#throwOnExpectationFailure) {
|
||||
@@ -10912,7 +10904,7 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
if (typeof deprecation === 'string') {
|
||||
deprecation = { message: deprecation };
|
||||
}
|
||||
this.result.deprecationWarnings.push(
|
||||
this.#result.deprecationWarnings.push(
|
||||
j$.private.buildExpectationResult(deprecation)
|
||||
);
|
||||
}
|
||||
@@ -11807,7 +11799,6 @@ getJasmineRequireObj().TreeRunner = function(j$) {
|
||||
|
||||
#suiteSegmentComplete(suite, next) {
|
||||
suite.endTimer();
|
||||
const result = suite.doneEvent();
|
||||
const isTopSuite = suite === this.#executionTree.topSuite;
|
||||
|
||||
if (!isTopSuite) {
|
||||
@@ -11823,14 +11814,14 @@ getJasmineRequireObj().TreeRunner = function(j$) {
|
||||
this.#runableResources.clearForRunable(suite.id);
|
||||
this.#currentRunableTracker.popSuite();
|
||||
|
||||
if (result.status === 'failed') {
|
||||
if (suite.doneEvent().status === 'failed') {
|
||||
this.#hasFailures = true;
|
||||
}
|
||||
}
|
||||
|
||||
const finish = isTopSuite
|
||||
? next
|
||||
: () => this.#reportSuiteDone(suite, result, next);
|
||||
: () => this.#reportSuiteDone(suite, next);
|
||||
|
||||
if (suite.hadBeforeAllFailure) {
|
||||
this.#reportChildrenOfBeforeAllFailure(suite).then(finish);
|
||||
@@ -11839,9 +11830,9 @@ getJasmineRequireObj().TreeRunner = function(j$) {
|
||||
}
|
||||
}
|
||||
|
||||
#reportSuiteDone(suite, result, next) {
|
||||
#reportSuiteDone(suite, next) {
|
||||
suite.reportedDone = true;
|
||||
this.#reportDispatcher.suiteDone(result).then(next);
|
||||
this.#reportDispatcher.suiteDone(suite.doneEvent()).then(next);
|
||||
}
|
||||
|
||||
async #specComplete(spec) {
|
||||
@@ -11865,11 +11856,6 @@ getJasmineRequireObj().TreeRunner = function(j$) {
|
||||
if (child instanceof j$.private.Suite) {
|
||||
await this.#reportDispatcher.suiteStarted(child.startedEvent());
|
||||
await this.#reportChildrenOfBeforeAllFailure(child);
|
||||
|
||||
// Marking the suite passed is consistent with how suites that
|
||||
// contain failed specs but no suite-level failures are reported.
|
||||
child.result.status = 'passed';
|
||||
|
||||
await this.#reportDispatcher.suiteDone(child.doneEvent());
|
||||
} else {
|
||||
/* a spec */
|
||||
|
||||
Reference in New Issue
Block a user