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
don't call extends.nonEnum in spy.resetHistory #1984
Conversation
Oh, nice! Is there already a test verifying that |
Well, seems in #1975 no test was added to verify that spy/subs/.. do not expose any enumerable properties. I will add some test for this. |
@ehmicky I found that an enumerable property named |
@Flarna I unfortunately don't remember. However I do remember that I kept few properties visible because it broke the tests and/or it was introducing too many changes in a codebase I am not familiar with. |
- fix spy.fakes should be non enumerable - add tests
Added tests. I found that stubs still have their properties enumerable. It would be quite easy to change this but I don't think I should add this here. |
Thanks for putting this together. There is no need to split this into separate PRs. However, I'd like those tests to be more focused on the enumerable porperties. We're already testing the spy functionality extensively. I can help and change them myself, if you give me permission to push to this PR. |
@mantoni You should have permissions to add commits (according to the checkbox The main idea here was to call serveral spy APIs to ensure that they don't add any enumerable properties. Maybe just remove the asserts there and keep only that ones checking the enumerable properties? |
Yeah, that should be good enough I think 👍 |
Thank you 👍 |
This has been published as |
Could you update Changelog and create new release based on 7.2.5 plz ? |
Sure thing. Will do right now. |
@mroderick Do you have pending commits for master to push maybe? |
@3z3qu13l Change log and documentation page have been updated. |
- don't call extends.nonEnum in spy.resetHistory - fix that mirrored properties are kept enumerable - fix spy.fakes should be non enumerable - add tests
Purpose (TL;DR) - mandatory
Fixes #1983 by not calling
extends.nonEnum()
inspy.resetHistory()
It seems that
extends.nonEnum()
is significant slower then just setting properties. By ensuring that the properties on the proxy exist as non enumerable during creation it's not needed to useextends.nonEnum()
during updating them.Refs: #1975
How to verify - mandatory
npm install
npm test
Not sure what to write here as there is no functional change...
Checklist for author
npm run lint
passes