Add explicit fail function.
- Adds an expectation failure to the current spec [finishes #70975468] Fix #563
This commit is contained in:
@@ -335,6 +335,22 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
this.pending = function() {
|
||||
throw j$.Spec.pendingSpecExceptionMessage;
|
||||
};
|
||||
|
||||
this.fail = function(error) {
|
||||
var message = 'Failed';
|
||||
if (error) {
|
||||
message += ': ';
|
||||
message += error.message || error;
|
||||
}
|
||||
|
||||
currentSpec.addExpectationResult(false, {
|
||||
matcherName: '',
|
||||
passed: false,
|
||||
expected: '',
|
||||
actual: '',
|
||||
message: message
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
return Env;
|
||||
|
||||
@@ -32,6 +32,10 @@ getJasmineRequireObj().interface = function(jasmine, env) {
|
||||
return env.pending();
|
||||
},
|
||||
|
||||
fail: function() {
|
||||
return env.fail.apply(env, arguments);
|
||||
},
|
||||
|
||||
spyOn: function(obj, methodName) {
|
||||
return env.spyOn(obj, methodName);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user