Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

sinon

> 测试质量
Open source

Test spies, stubs and mocks for JavaScript.

9.8K stars0 likes2 views
WebsiteGitHub

About

Test spies, stubs and mocks for JavaScript.


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`](COMPATIBILITY.md) ## Installation via [npm](https://github.com/npm/npm) $ npm install sinon or via Sinon's browser builds available for download on the [homepage](https://sinonjs.org/releases/). There are also [npm based CDNs](https://sinonjs.org/releases#npm-cdns) one can use. ## Usage See the [sinon project homepage](https://sinonjs.org/) 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](https://stackoverflow.com/questions/tagged/sinon). ## 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](CONTRIBUTING.md) for details on how you can contribute to Sinon.JS. Artifact-first [contract tests](CONTRIBUTING.md#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](https://opencollective.com/sinon#backer)] ## Sponsors Become a sponsor and get your logo on our README on GitHub with a link to your site. [[Become a sponsor](https://opencollective.com/sinon#sponsor)] ## Licence Sinon.js was released under [BSD-3](LICENSE)

Issues· 69 open

View all issuesOpen on GitHub
  • #2760

    createStubInstance() doesn't receive per-sandbox callId context, breaking calledAfter/calledBefore vs spy()

    Updated Aug 9, 2026
  • #2742

    Move documentation site to CloudFlare Pages

    Updated Jul 1, 2026
  • #2739

    Add tutorial pages to docs

    DocumentationUpdated Jun 30, 2026
  • #2719

    Feature request: Addition of Canary Credentials to detect compromise

    Updated Jun 1, 2026
  • #2714

    How to stub ES module imports documentation is incorrect

    Updated May 15, 2026
  • #2665

    Consider Adopting NPM Trusted Publishing

    Updated Dec 19, 2025
  • #2663

    callsFake() on mocks only returns a value the first time

    BugUnverifiedUpdated Sep 13, 2025
  • #2662

    Support explicit resource management

    Updated Aug 29, 2025
  • #2657

    Replace sinon.assert.pass() with an event listener

    Updated Jun 9, 2025
  • #2652

    Improve migration guide re v20

    Updated Apr 30, 2025

> Tags

JavaScriptjavascriptsinonstubstubs

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 29, 2026
Category测试质量
PricingOpen source

> Related tools

J
Jest
JavaScript 测试框架
P
Playwright
现代端到端测试框架
E
eslint-plugin-test-selectors
Enforces that data-test-id attributes are added to interactive DOM elements (JSX) to help with UI testing. JSX only.