Skip to content
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

Protect replace from modifying the prototype #138

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

danthegoodman
Copy link

mock(Knex) is storing the original functions on a replacement object, but when being set lodash is storing it on the real object prototype. This change modifies the replacement storage to put the function on a renamed prototype object much like the constructor.

This allows unmock(Knex) to properly restore all mocked functions.

Fixes #126

mock(Knex) is storing the original functions on a replacement object, 
but when being set lodash is storing it on the real object prototype.
This change modifies the replacement storage to put the function on
a renamed prototype object much like the constructor.

This allows unmock(Knex) to properly restore all mocked functions.

Fixes jbrumwell#126
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

unmock does not work correctly
1 participant