sinonjs / sinon

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

Avoid return and callArg* clearing each other's state #2593

Closed fatso83 closed 2 months ago

fatso83 commented 2 months ago

Purpose (TL;DR) - mandatory

This partially reverts changes done in #2567, as the clearing of state was a bit too invasive. It is fully possible to have functions that both call callbacks and return values, which was made impossible by this change.

I kept the tests, which proves this fix is not affecting the intent of the original fix, and additionally added a regression test for #2572 to make sure it keeps that way.

How to verify - mandatory

  1. Check out this branch
  2. npm install

Checklist for author