Skip to content

Commit

Permalink
chore(jasmine): update MatchFactory to allow message as function
Browse files Browse the repository at this point in the history
  • Loading branch information
juliemr committed Feb 9, 2016
1 parent 750898c commit 5abc745
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,19 @@ jasmine.Expectation.prototype.wrapCompare = function(name, matcherFactory) {
var result = matcherCompare.apply(null, args);

return webdriver.promise.when(result.pass).then(function(pass) {
var message = "";
var message = '';

if (!pass) {
if (!result.message) {
args.unshift(expectation.isNot);
args.unshift(name);
message = expectation.util.buildFailureMessage.apply(null, args);
} else {
message = result.message;
if (Object.prototype.toString.apply(result.message) === '[object Function]') {
message = result.message();

This comment has been minimized.

Copy link
@M0ns1gn0r

M0ns1gn0r Feb 3, 2017

Contributor

Please see #29

The current implementation does allow my function to detect, that it's actually a "not()" call.

} else {
message = result.message;
}
}
}

Expand Down

0 comments on commit 5abc745

Please sign in to comment.