Skip to content

Commit 5abc745

Browse files
committed
chore(jasmine): update MatchFactory to allow message as function
1 parent 750898c commit 5abc745

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

index.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -192,15 +192,19 @@ jasmine.Expectation.prototype.wrapCompare = function(name, matcherFactory) {
192192
var result = matcherCompare.apply(null, args);
193193

194194
return webdriver.promise.when(result.pass).then(function(pass) {
195-
var message = "";
195+
var message = '';
196196

197197
if (!pass) {
198198
if (!result.message) {
199199
args.unshift(expectation.isNot);
200200
args.unshift(name);
201201
message = expectation.util.buildFailureMessage.apply(null, args);
202202
} else {
203-
message = result.message;
203+
if (Object.prototype.toString.apply(result.message) === '[object Function]') {
204+
message = result.message();
205+
} else {
206+
message = result.message;
207+
}
204208
}
205209
}
206210

0 commit comments

Comments
 (0)