Back to Sinon

spy.resetHistory

docs/concepts/spies/api/reset-history.md

22.1.0621 B
Original Source

spy.resetHistory

Resets the state of a fake, spy or stub.

<<< ../../../.vitepress/tests/docs/spies/api/reset-history.test.js

In the example above, we can see that callCount is reset. Resetting history resets all recording properties of a fake, spy or stub, there are too many to list here.

Other ways of resetting history

You can also reset the history for the whole sandbox, by using sinon.resetHistory or sinon.reset.