Allow user to stop a specs execution when an expectation fails
[finish #1165916] #577
This commit is contained in:
parent
1a08d1e8c6
commit
7693a4c959
@@ -12,6 +12,7 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
this.expectationResultFactory = attrs.expectationResultFactory || function() { };
|
||||
this.queueRunnerFactory = attrs.queueRunnerFactory || function() {};
|
||||
this.catchingExceptions = attrs.catchingExceptions || function() { return true; };
|
||||
this.throwOnExpectationFailure = !!attrs.throwOnExpectationFailure;
|
||||
|
||||
if (!this.queueableFn.fn) {
|
||||
this.pend();
|
||||
@@ -33,6 +34,10 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
this.result.passedExpectations.push(expectationResult);
|
||||
} else {
|
||||
this.result.failedExpectations.push(expectationResult);
|
||||
|
||||
if(this.throwOnExpectationFailure){
|
||||
throw new j$.errors.ExpectationFailed();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -76,6 +81,10 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (e instanceof j$.errors.ExpectationFailed) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.addExpectationResult(false, {
|
||||
matcherName: '',
|
||||
passed: false,
|
||||
|
||||
Reference in New Issue
Block a user