diff --git a/lib/sinon/assert.js b/lib/sinon/assert.js index 28876673b..b8760c939 100644 --- a/lib/sinon/assert.js +++ b/lib/sinon/assert.js @@ -79,6 +79,7 @@ function mirrorPropAsAssertion(name, method, message) { var failed = false; verifyIsValidAssertion(name, args); + if (typeof method === "function") { failed = !method(fake); } else { diff --git a/lib/sinon/spy.js b/lib/sinon/spy.js index f1f68685d..4b2b46d75 100644 --- a/lib/sinon/spy.js +++ b/lib/sinon/spy.js @@ -467,10 +467,10 @@ spyApi.formatters = { for (var j = 0; j < calledArgs.length || j < args.length; ++j) { message += "\n"; var calledArgMessage = j < calledArgs.length ? sinonFormat(calledArgs[j]) : ""; - var expectedArgMessage = j < args.length ? sinonFormat(args[j]) : ""; if (sinonMatch.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); }