Generate jasmine.js for suite reporting changes

Signed-off-by: Elenore Bastian <ebastian@pivotal.io>
This commit is contained in:
Gregg Van Hove
2018-01-23 14:38:40 -08:00
committed by Elenore Bastian
parent 12a47f05bf
commit 9a96396f65

View File

@@ -1216,9 +1216,7 @@ getJasmineRequireObj().Env = function(j$) {
}
if (declarationError) {
self.it('encountered a declaration exception', function() {
throw declarationError;
});
suite.onException(declarationError);
}
currentDeclarationSuite = parentSuite;
@@ -5646,52 +5644,32 @@ getJasmineRequireObj().Suite = function(j$) {
return;
}
if(isAfterAll(this.children)) {
var data = {
matcherName: '',
passed: false,
expected: '',
actual: '',
error: arguments[0]
};
var failedExpectation = this.expectationResultFactory(data);
var data = {
matcherName: '',
passed: false,
expected: '',
actual: '',
error: arguments[0]
};
var failedExpectation = this.expectationResultFactory(data);
if (!this.parentSuite) {
failedExpectation.globalErrorType = 'afterAll';
}
this.result.failedExpectations.push(failedExpectation);
} else {
for (var i = 0; i < this.children.length; i++) {
var child = this.children[i];
child.onException.apply(child, arguments);
}
if (!this.parentSuite) {
failedExpectation.globalErrorType = 'afterAll';
}
this.result.failedExpectations.push(failedExpectation);
};
Suite.prototype.addExpectationResult = function () {
if(isAfterAll(this.children) && isFailure(arguments)){
if(isFailure(arguments)) {
var data = arguments[1];
this.result.failedExpectations.push(this.expectationResultFactory(data));
if(this.throwOnExpectationFailure) {
throw new j$.errors.ExpectationFailed();
}
} else {
for (var i = 0; i < this.children.length; i++) {
var child = this.children[i];
try {
child.addExpectationResult.apply(child, arguments);
} catch(e) {
// keep going
}
}
}
};
function isAfterAll(children) {
return children && children[0].result.status;
}
function isFailure(args) {
return !args[0];
}