You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What did you expect to happen?
I expect calls to sandbox.reset() to invoke spy.resetHistory() for spies in the collection.
What actually happens
Calls to sandbox.reset() invoke reset() on all fakes in its collection. Now that reset() has been removed from the spy API and no longer aliases resetHistory(), the spy history is no longer reset.
How to reproduce
// in beforeAll:
navigateSpy = sandbox.spy(TestBed.get(Router), 'navigate');
// in afterEach:
sandbox.reset();
// in tests, cause a call to Router.navigate and then check spy call count
Related issue:
Issue #1712 is technically resolved with release 5.0.1, but it breaks the ability to reset the call count for spies contained within a sandbox when sandbox.reset() is called.
Proposed fix:
In lib\sinon\sandbox.js:
Change implementation of sandbox.reset to be:
sandbox.reset = function reset() {
this.resetHistory();
this.resetBehavior();
};
This matches the implementation in lib\sinon\stub.js
The text was updated successfully, but these errors were encountered:
mroderick
added a commit
to mroderick/sinon
that referenced
this issue
May 1, 2018
What did you expect to happen?
I expect calls to
sandbox.reset()
to invokespy.resetHistory()
for spies in the collection.What actually happens
Calls to
sandbox.reset()
invokereset()
on all fakes in its collection. Now thatreset()
has been removed from the spy API and no longer aliasesresetHistory()
, the spy history is no longer reset.How to reproduce
Related issue:
Issue #1712 is technically resolved with release 5.0.1, but it breaks the ability to reset the call count for spies contained within a sandbox when
sandbox.reset()
is called.Proposed fix:
In
lib\sinon\sandbox.js
:Change implementation of
sandbox.reset
to be:This matches the implementation in
lib\sinon\stub.js
The text was updated successfully, but these errors were encountered: