Skip to content

Feature request: td.func().reset() (reset spy/stub state) #529

@JakobJingleheimer

Description

@JakobJingleheimer

In many cases, spies are re-useable, so they can be set up at the root of the test.

When asserting cases where a spy may or may not have been called, the spy's state needs to be re-set between cases (via afterEach).

At current, it seems the only way to effectively re-set a testdouble spy/stub's state is to overwrite the whole thing with a fresh spy, which creates a daisy-chain of make-work: that spy is likely being fed into a module replacement, so now the module has to be needlessly replaced every time the spy/stub is re-set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions