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
An update to @keithjgrant answer.
From version v2.0.0 onwards, the sinon.test method has been moved to a separate sinon-test module. To make the old tests pass you need to configure this extra dependency in each test:
var sinonTest = require('sinon-test');
sinon.test = sinonTest.configureTest(sinon);
Alternatively, you do without sinon-test and use sandboxes:
var sandbox = sinon.sandbox.create();
afterEach(function () {
sandbox.restore();
});
it('should restore all mocks stubs and spies between tests', function() {
sandbox.stub(some, 'method'); // note the use of "sandbox"
}