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) { if (declarationError) {
self.it('encountered a declaration exception', function() { suite.onException(declarationError);
throw declarationError;
});
} }
currentDeclarationSuite = parentSuite; currentDeclarationSuite = parentSuite;
@@ -5646,52 +5644,32 @@ getJasmineRequireObj().Suite = function(j$) {
return; return;
} }
if(isAfterAll(this.children)) { var data = {
var data = { matcherName: '',
matcherName: '', passed: false,
passed: false, expected: '',
expected: '', actual: '',
actual: '', error: arguments[0]
error: arguments[0] };
}; var failedExpectation = this.expectationResultFactory(data);
var failedExpectation = this.expectationResultFactory(data);
if (!this.parentSuite) { if (!this.parentSuite) {
failedExpectation.globalErrorType = 'afterAll'; 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);
}
} }
this.result.failedExpectations.push(failedExpectation);
}; };
Suite.prototype.addExpectationResult = function () { Suite.prototype.addExpectationResult = function () {
if(isAfterAll(this.children) && isFailure(arguments)){ if(isFailure(arguments)) {
var data = arguments[1]; var data = arguments[1];
this.result.failedExpectations.push(this.expectationResultFactory(data)); this.result.failedExpectations.push(this.expectationResultFactory(data));
if(this.throwOnExpectationFailure) { if(this.throwOnExpectationFailure) {
throw new j$.errors.ExpectationFailed(); 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) { function isFailure(args) {
return !args[0]; return !args[0];
} }