diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index b272a740..017417b2 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -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]; }