Is there a way to easily reset all sinon spys mocks and stubs that will work cleanly with mocha\'s beforeEach blocks.
I see sandboxing is an option but I do not see
You may use sinon.collection as illustrated in this blog post (dated May 2010) by the author of the sinon library.
The sinon.collection api has changed and a way to use it is the following:
beforeEach(function () {
fakes = sinon.collection;
});
afterEach(function () {
fakes.restore();
});
it('should restore all mocks stubs and spies between tests', function() {
stub = fakes.stub(window, 'someFunction');
}