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

No obvious way to reset fakes #1815

Closed
akdor1154 opened this issue May 30, 2018 · 4 comments
Closed

No obvious way to reset fakes #1815

akdor1154 opened this issue May 30, 2018 · 4 comments

Comments

@akdor1154
Copy link

akdor1154 commented May 30, 2018

Describe the bug
There's no obvious or documented way to reset the history of all fakes.

To Reproduce

const sinon = require('sinon');
const fake = sinon.fake();
fake(1234);
sinon.resetHistory();
fake.getCalls() // returns [Call(1234)]

sinon.reset();
fake.getCalls() // returns [Call(1234)]
const sandbox = sinon.createSandbox();
const fake = sandbox.fake() // error, can't make fakes from sandboxes (why??)

Expected behavior
All the above behaviours should return [] instead of [Call(1234), and sandboxes should be able to create fakes (in order to reset a set of fakes together).

  • Library version: 5.0.10
  • Environment: ubuntu 18.04
@mroderick
Copy link
Member

I agree.

Sandboxes, including the default sandbox sinon, should be able to reset fakes.

nivsherf added a commit to nivsherf/sinon that referenced this issue Jun 15, 2018
nivsherf added a commit to nivsherf/sinon that referenced this issue Jun 16, 2018
nivsherf added a commit to nivsherf/sinon that referenced this issue Jun 16, 2018
@Horaddrim
Copy link

So this issue is resolved?

@mroderick
Copy link
Member

Yes, with #1842

@akdor1154
Copy link
Author

thanks guys.

franck-romano pushed a commit to franck-romano/sinon that referenced this issue Oct 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants