sinonjs /sinon

Test spies, stubs and mocks for JavaScript.

★ 9,752⑂ 816👁 88⑃ 1,409● 1,389▤ 22
JavaScriptNOASSERTIONCreated 2010-06-29sinonjs.org/
下载:Make resetHistory work for propsMake-4.2.2 ↓4.2.22018-01-26
+0
日增长
9,752
stars
816
forks
88
watchers
1,409
prs
1,389
issues
22
releases

README

Sinon.JS



    Standalone and test framework agnostic JavaScript test spies, stubs and mocks (pronounced "sigh-non", named after Sinon, the warrior).















  


--

 Compatibility

For details on compatibility and browser support, please see COMPATIBILITY.md

 Installation

via npm

    $ npm install sinon

or via Sinon's browser build, shipped in the package's pkg/ directory and served by
npm based CDNs such as jsDelivr and
unpkg.

 Usage

See the sinon project homepage for documentation on usage.

If you have questions that are not covered by the documentation, you can check out the sinon tag on Stack Overflow.

 Goals

- No global pollution
- Easy to use
- Require minimal “integration”
- Easy to embed seamlessly with any testing framework
- Easily fake any interface
- Ship with ready-to-use fakes for timers

 Contribute?

See CONTRIBUTING.md for details on how you can contribute to Sinon.JS. Artifact-first contract tests are used to protect public APIs during migration.
The lib/ directory is generated build output and is not committed to the repository; run npm run build to regenerate it locally when needed.

 Backers

Thank you to all our backers! 🙏 [Become a backer]



 Sponsors

Become a sponsor and get your logo on our README on GitHub with a link to your site. [Become a sponsor]













 Licence

Sinon.js was released under BSD-3

Top issues

Discussions

Latest release

Make resetHistory work for props v4.2.2 2018-01-26
Fix 1638: Make resetHistory work for props

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON