Determine overall status in core, not reporters
[#92261606] [#78679648]
This commit is contained in:
committed by
Steve Gravrock
parent
5906a2c05c
commit
db615e4186
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user