sinonjs / sinon

Test spies, stubs and mocks for JavaScript.
https://sinonjs.org/
Other
9.6k stars 769 forks source link

fix #2589: avoid invoking getter as side-effect #2592

Closed fatso83 closed 2 months ago

fatso83 commented 2 months ago

Purpose (TL;DR) - mandatory

Fix the issue in #2589 by checking for the odd case where we actually force setting a value through accessor functions and only look up the value at that time.

The alternative would be more elaborate, check if the descriptor had a get or a value field, and then decide, but this should do the trick.

How to verify - mandatory

  1. Check out this branch
  2. npm install
  3. npm test

Checklist for author