You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looks like #692 does not work with sandbox. I am using sinon@1.17.3 from node
The following code throws error TypeError: Cannot set property foo of #<Object> which has only a getter at Object.stub while stubbing the getter
var o = {
get foo() { return 'foo' }
};
var mySandbox = sinon.sandbox.create();
mySandbox.stub(o, 'foo', { get: function () { return 'foo stubbed via sandbox' }});
This works as expected
var o = {
get foo() { return 'foo' }
};
sinon.stub(o, 'foo', { get: function () { return 'foo stubbed' }});
console.log(o.foo); // foo stubbed
The text was updated successfully, but these errors were encountered:
Looks like #692 does not work with
sandbox
. I am usingsinon@1.17.3
from nodeThe following code throws error
TypeError: Cannot set property foo of #<Object> which has only a getter at Object.stub
while stubbing the getterThis works as expected
The text was updated successfully, but these errors were encountered: