Sinon: No obvious way to reset fakes

Created on 30 May 2018  ·  4Comments  ·  Source: sinonjs/sinon

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
Help wanted

Most helpful comment

Yes, with #1842

All 4 comments

I agree.

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

So this issue is resolved?

Yes, with #1842

thanks guys.

Was this page helpful?
0 / 5 - 0 ratings