Spies for property accessors are not automatically cleaned up
fatso83 opened this issue · 0 comments
fatso83 commented
Describe the bug
If we use Sinon to spy on property accessors, these spies are not cleaned up (restored) when restoring the sandbox.
To Reproduce
Steps to reproduce the behavior:
const executeInsertSpy = sinon.spy(o, "executeInsert", ["get"]);
o.executeInsert
o.executeInsert
assert.equals(executeInsertSpy, 2);
sinon.restore();
executeInsertSpy.get.restore(); // We should not be able to or be required to do this. BUG!
Expected behavior
All spies are cleaned up
Context (please complete the following information):
Library version: 15.2.0
Environment: node v18.16.1
Additional context
Found when deep diving into #2523
Runnable example
https://runkit.com/fatso83/649df02251b50f0008d1e3a6