// Sinon spy function var callback = sinon.spy(); callback(); callback.called; callback.callCount; callback.calledWith(arg1); callback.threw(); callback.returned(obj); callback.calledBefore(spy); callback.calledAfter(spy); // Sinon spy method sinon.spy($, "ajax"); $.ajax({ / ... / }); var call = $.ajax.getCall(0); call.args; call.exception; call.returnValue; $.ajax.restore();