Standalone test spies, stubs and mocks for JavaScript. Works with any unit testing framework.
Sinon.JS is a standalone test spies, stubs and mocks for JavaScript. It works with any unit testing framework and is often used in conjunction with Mocha, Jasmine, and other testing frameworks. Sinon.JS provides tools to easily create and manage test doubles, making it easier to test JavaScript code in isolation.
4500 / day
5000 / day
2.5 pages per visit
Domain Rating
Domain Authority
Citation Level
English, etc
Functions that record arguments, return value, the value of this and exception thrown (if any) for all its calls.
Functions (spies) with pre-programmed behavior. They support the full test spy API in addition to methods which can be used to alter the stub's behavior.
Fake methods (like spies) with pre-programmed behavior (like stubs) as well as pre-programmed expectations.
Provides a clock object to manipulate time, useful for testing time-dependent code.
Provides a fake XMLHttpRequest object and a fake server to simulate server responses.
Comes with a set of assertions that can be used with any test spy, stub, or mock.
Allows for easy creation and restoration of test doubles, ensuring tests do not affect each other.
Sinon.JS is released under the BSD license.
The source code for Sinon.JS is available on GitHub, allowing for community contributions and forks.
Sinon.JS has a vibrant community with support available through GitHub issues, Stack Overflow, and other forums.
Comprehensive documentation is available on the Sinon.JS website, including guides, API references, and examples.
Sinon.JS is compatible with all modern browsers and Node.js environments.
Contributions to Sinon.JS are welcome, with guidelines available for submitting pull requests and reporting issues.
Security headers report is a very important part of user data protection. Learn more about http headers for sinonjs.org