From eb67655e72ae82df846fba4c43b13f13c9c28d99 Mon Sep 17 00:00:00 2001 From: Matthew Tretter Date: Thu, 17 Oct 2013 16:48:06 -0400 Subject: [PATCH 1/2] Test that context returns the result of the wrapped function --- test/raven.test.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/raven.test.js b/test/raven.test.js index 7e2fe4b2c6e0..f808efabb36a 100644 --- a/test/raven.test.js +++ b/test/raven.test.js @@ -956,6 +956,12 @@ describe('Raven (public API)', function() { Raven.context(spy); assert.deepEqual(spy.lastCall.args, []); }); + + it('should return the result of the wrapped function', function() { + var val = {}; + var func = function() { return val; }; + assert.equal(Raven.context(func), val); + }); }); describe('.uninstall', function() { From e3d46ce05282756eab73795619a9850f31a3940e Mon Sep 17 00:00:00 2001 From: Matthew Tretter Date: Thu, 17 Oct 2013 16:48:34 -0400 Subject: [PATCH 2/2] Return result of wrapped function from context --- src/raven.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/raven.js b/src/raven.js index 742b56bc02b0..b6bb11692628 100644 --- a/src/raven.js +++ b/src/raven.js @@ -140,7 +140,7 @@ var Raven = { options = undefined; } - Raven.wrap(options, func).apply(this, args); + return Raven.wrap(options, func).apply(this, args); }, /*