Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
D: function(spyInstance, args) {
var message = "";
for (var i = 0, l = spyInstance.callCount; i < l; ++i) {
// describe multiple calls
if (l > 1) {
message += "\nCall " + (i + 1) + ":";
}
var calledArgs = spyInstance.getCall(i).args;
for (var j = 0; j < calledArgs.length || j < args.length; ++j) {
message += "\n";
var calledArgMessage = j < calledArgs.length ? sinonFormat(calledArgs[j]) : "";
if (match.isMatcher(args[j])) {
message += colorSinonMatchText(args[j], calledArgs[j], calledArgMessage);
} else {
var expectedArgMessage = j < args.length ? sinonFormat(args[j]) : "";
var diff = jsDiff.diffJson(calledArgMessage, expectedArgMessage);
message += colorDiffText(diff);
}
}
}
return message;
},
function verifyMatcher(possibleMatcher, arg) {
var isMatcher = match.isMatcher(possibleMatcher);
return (isMatcher && possibleMatcher.test(arg)) || true;
}
calledOn: function calledOn(thisValue) {
if (match.isMatcher(thisValue)) {
return thisValue.test(this.thisValue);
}
return this.thisValue === thisValue;
},