New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sinon fails when restoring stubbed properties in window object in IE11 #1881
Comments
….stub.value() bug More details: sinonjs/sinon#1881 Change-Id: Iaad8c012f34cf2c6a808d3c4ca977cbf9a3ad024 BCP: 1870331288
….stub.value() bug More details: sinonjs/sinon#1881 CR-Id: 002075125800003075332018 Change-Id: Iaad8c012f34cf2c6a808d3c4ca977cbf9a3ad024 BCP: 1870331288 (cherry picked from commit ba9b797)
Thank you for your detailed description of the issue. Would going with the second strategy actually make this work in IE11? If so, that would be my preference. Would you be up for contributing a pull request to make the necessary changes? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I having same problem and I found cause of this on sinon/default-behaviors.js line 258. value: function value(fake, newVal) {
var rootStub = fake.stub || fake;
Object.defineProperty(rootStub.rootObj, rootStub.propName, {
value: newVal,
enumerable: true,
configurable: isPropertyConfigurable(rootStub.rootObj, rootStub.propName)
});
return fake;
} I don't know why it should follow original object's configurable option. I think it have to be always true because After it stubed, it can be restored or rewritten (typically sinon.restore()) regardless of original object's option. Temporarily I fixed this problem by changing that code always return true. |
We haven't supported IE11 in years, so this will not be fixed. |
Describe the bug
it's possible to stub, but not to restore some properties in window object in IE11 causing sinon to throw a type error:
TypeError: Cannot redefine non-configurable property '...'
To Reproduce
https://jsbin.com/qixexucasa/edit?js,console,output - compare behaviour in IE11 and any other browser.
Expected behavior
In IE11 certain properties of window object are non-configurable, but it's still possible to stub them and this is quite useful in the tests. The expectable behaviour would be one of those:
configurable
attribute, is there any reason for this? In case offalse
value sinon just creates problems for itself, so it's not possible to restore it. So this line should be alwaystrue
:sinon/lib/sinon/default-behaviors.js
Line 251 in 638e104
Context:
Please confirm whether it's a bug or an expected behaviour.
The text was updated successfully, but these errors were encountered: