question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The meaning of spy.reset is ambiguous (see discussion in #138). What exactly does it reset? The call count? The return/thrown values?

My vote is to either remove it or make its meaning more clear. If we remove it, the simple upgrade path is to substitute all uses of spy.reset() with spy.calls = []. Super easy.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ljharbcommented, Jul 27, 2016

ie, it can’t be easily thrown away, so it’s helpful to reset its state.

0reactions
mjacksoncommented, Jul 27, 2016

It looks like proxyquire is using sinon for its spies implementation. Besides, seems like in the case you describe proxyquire would be creating incidental complexity and forcing me to handle it. Feels like a leaky abstraction.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Will Factory Reset Remove Spy App? Tried & Tested
Yes, a factory deletes everything including photos, apps, contacts, and spyware from the phone. Can You Uninstall Spyware? Spy apps basically ...
Read more >
How to reset or clear a spy in Jest?
So we can use mockClear to "reset" a spy. ... In jest.config.js add mockReset - not clearMocks, as that will not remove any...
Read more >
Does factory reset on Android remove spywares?
Yes, you can get rid of spyware by a factory reset! Roberto's answer is very wrong and is talking about xHelper which is...
Read more >
Bring back spy.reset() · Issue #104 · chaijs/chai-spies
A previous issue #27 introduced the reset method to this library which we use extensively. It was removed in 1.0 for no clear...
Read more >
Jest set, clear and reset mock/spy/stub implementation
Between test runs we need mocked/spied on imports and functions to be reset so that assertions don't fail due to stale calls (from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found