Skip to content

Spies for property accessors are not automatically cleaned up #2534

@fatso83

Description

@fatso83

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions