You can use the poorly-named [sinon.sandbox](http://sinonjs.org/docs/#sandbox) to simplify cleanup.