-
Notifications
You must be signed in to change notification settings - Fork 388
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
Modify Object.prototype
in the tests
#179
Conversation
I'd prefer these to be explicit tests that set and delete the Object.prototype values, rather than setting them for all tests blindly. |
I disagree. Might as well apply it to all tests in those files, in case some new tests (added later on) highlight similar bugs in other parts of the code. |
What happens if the presence of something extra on Object.prototype masks an improper test for something new? If you want to run the tests twice, once with the modifications and once without, that would allay my concerns, but only running tests in an environment where Object.prototype is modified (a very unlikely, hugely discouraged environment in the first place) is going to reflect the minority case, not the majority. |
IMHO that seems way more far-fetched than something breaking because of |
The whole premise of these tests and the previous patch is something breaking because |
Yeah, my point exactly. |
So anything that's at risk of breaking when it's extended needs to be tested both when it is extended, and when it's not - otherwise we risk a regression in a pristine environment. Either likelihood is irrelevant and all possibilities need to be accounted for, or likelihood matters and we don't need to concern ourselves with people who modify Object.prototype, since that basically never happens. |
Everything is at risk of breaking when natives are extended. That’s why running all tests in such an environment is usually a good idea. The chance of some legitimate bug being masked by an extended native is extremely small — much smaller than the possibility of running code in a tainted environment, but I’m fine with running the tests in a pristine environment in addition to that if it helps you sleep at night ;) |
Modify `Object.prototype` in the tests
Ref. #175, #177.