From 3b52d015ea07b1622ab8d137515aff8bd1d06ee3 Mon Sep 17 00:00:00 2001 From: pimterry Date: Sat, 7 Dec 2013 20:17:29 +0000 Subject: [PATCH] Track return values of spy functions --- src/core/base.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/core/base.js b/src/core/base.js index 9fe678cd..8505e1e1 100644 --- a/src/core/base.js +++ b/src/core/base.js @@ -56,11 +56,16 @@ getJasmineRequireObj().base = function(j$) { }), callTracker = new j$.CallTracker(), spy = function() { - callTracker.track({ + var callData = { object: this, args: Array.prototype.slice.apply(arguments) - }); - return spyStrategy.exec.apply(this, arguments); + }; + + callTracker.track(callData); + var returnValue = spyStrategy.exec.apply(this, arguments); + callData.returnValue = returnValue; + + return returnValue; }; for (var prop in originalFn) {