Sinon.JS
Test spies, stubs and mocks for JavaScript
...As of Sinon 10 we stopped maintaining compatibility with legacy browsers. Instead, we focus on compatibility with evergreen browsers, Node.js LTS versions and recent Safari versions. The most up-to-date reference on which runtimes and browsers we support can be found by looking at our compatibility docs. Fake timers are synchronous implementations of setTimeout and friends that Sinon.JS can overwrite the global functions with to allow you to more easily test code using them. A test spy is a function that records arguments, return value, the value of this and exception thrown (if any) for all its calls. ...