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

Use no-op for every function when restoring instances #2499

Merged
merged 3 commits into from Mar 12, 2023

Conversation

fatso83
Copy link
Contributor

@fatso83 fatso83 commented Mar 12, 2023

Purpose (TL;DR) - mandatory

Fixes the issue brought up in #2477 by adding default no-op implementations of all the functions present on the prototype of a stub instance object. This avoids issues that might arise if code traverses an object that already has been restored by having a default set of no-op function to fiddle with, instead of accidentally invoking stuff on the prototype which might or might not depend on the constructor being run to work correctly.

How to verify - mandatory

npm test and check against the example in #2477

Checklist for author

  • npm run lint passes
  • References to standard library functions are cached.

@fatso83 fatso83 merged commit 19bd99f into sinonjs:main Mar 12, 2023
8 checks passed
@fatso83 fatso83 deleted the issue-2477 branch March 12, 2023 21:08
fatso83 added a commit that referenced this pull request Mar 12, 2023
* issue-2477 Use no-op for every function when restoring instances
* Change wording to not depend on mutator type in tests
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.

None yet

1 participant