-
-
Notifications
You must be signed in to change notification settings - Fork 770
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
Fix: check configurable on a prop before creating (fixes #1456) #1462
Conversation
Thanks for the fix. There is just one thing missing IMHO and that is that, based on its description, the test you are adding does not seem to have anything to do with the code you are adding. I would move the existing test to the issues test file with a description that references the original issue (see the examples there). I would then add a test where the previous one was with code that does not reference the DOM, but rather creates an object with a property descriptor that would make Sinon fail previously, but that would pass now. |
@fatso83 Not sure what you mean but if you remove my source code changes and then run the test I added. It will fail. So i am not entirely sure what you mean by |
It's a semantic issue. The code deals with "check configurable on a prop before creating", but the test is if |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The core code itself LGTM, but as @fatso83 said, I think it would be good to change these tests so that they would run on every environment, since we're not targeting the window
properties themselves, we're testing non-configurable properties and the innerHeight
property just happens to be one.
In order to create a non configurable property you could just do:
const obj = {};
Object.defineProperty(obj, 'testProp', {
configurable: false
});
Then, instead of operating on the window
object you should operate on obj
.
By doing this you don't need this check anymore too, since you already have a "universally valid" object to test against.
Test code has been fixed. Let me know what you guys think. |
Great stuff. Btw, I extracted the test and tested it against No objections other than that you could have squashed the fix/amended the previous, but since we can do this directly nowadays I squashed and merged it directly 😄 Thanks! |
This has become |
That was quick. |
Too quick. The build fails in Safari 9.0 😨 |
Too bad. The 2000th commit should have been a celebration of our great automation setup 🥇 But 💩 happens 😄 At least we know about it! @gyandeeps If you wonder went wrong you can check out the logs from the Travis run:
|
woops... sorry about this guys... I didn't test it on safari as I use windows... but regardless I wouldn't have thought of testing this on safari. Not sure what the right solution is here because this is very safari thing. |
…nonjs#1462) * Fix: check configurable on a prop before creating (fixes sinonjs#1456)
Purpose (TL;DR) - mandatory
Fixes #1456 by making sure propert is made
configurable
based on the object props.@lucasfcosta have created a fix with my beast understanding of your proposal. Feedback is welcome. Thanks