Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JakobJingleheimer opened this issue Mar 20, 2024 · 0 comments
Open

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

JakobJingleheimer opened this issue Mar 20, 2024 · 0 comments

Comments

@JakobJingleheimer
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant