Determine overall status in core, not reporters

[#92261606]
[#78679648]
This commit is contained in:
Steve Gravrock
2017-11-14 14:49:41 -08:00
committed by Steve Gravrock
parent 5906a2c05c
commit db615e4186
8 changed files with 366 additions and 105 deletions

View File

@@ -29,6 +29,7 @@ getJasmineRequireObj().Env = function(j$) {
var random = true;
var seed = null;
var suppressLoadErrors = false;
var hasFailures = false;
var currentSuite = function() {
return currentlyExecutingSuites[currentlyExecutingSuites.length - 1];
@@ -311,6 +312,10 @@ getJasmineRequireObj().Env = function(j$) {
}
currentlyExecutingSuites.pop();
reporter.suiteDone(result);
if (result.status === 'failed') {
hasFailures = true;
}
},
orderChildren: function(node) {
return order.sort(node.children);
@@ -337,14 +342,31 @@ getJasmineRequireObj().Env = function(j$) {
processor.execute(function() {
clearResourcesForRunnable(topSuite.id);
currentlyExecutingSuites.pop();
var overallStatus, incompleteReason;
if (hasFailures || topSuite.result.failedExpectations.length > 0) {
overallStatus = 'failed';
} else if (focusedRunnables.length > 0) {
overallStatus = 'incomplete';
incompleteReason = 'fit() or fdescribe() was found';
} else if (totalSpecsDefined === 0) {
overallStatus = 'incomplete';
incompleteReason = 'No specs found';
} else {
overallStatus = 'passed';
}
/**
* Information passed to the {@link Reporter#jasmineDone} event.
* @typedef JasmineDoneInfo
* @property {OverallStatus} - The overall result of the sute: 'passed', 'failed', or 'incomplete'.
* @property {IncompleteReason} - Explanation of why the suite was incimplete.
* @property {Order} order - Information about the ordering (random or not) of this execution of the suite.
* @property {Expectation[]} failedExpectations - List of expectations that failed in an {@link afterAll} at the global level.
*/
reporter.jasmineDone({
overallStatus: overallStatus,
incompleteReason: incompleteReason,
order: order,
failedExpectations: topSuite.result.failedExpectations
});
@@ -536,6 +558,10 @@ getJasmineRequireObj().Env = function(j$) {
clearResourcesForRunnable(spec.id);
currentSpec = null;
reporter.specDone(result);
if (result.status === 'failed') {
hasFailures = true;
}
}
function specStarted(spec) {