Sinon.JS

JavaScript 的 测试侦探、桩和mock。(Test spies, stubs and mocks for JavaScript.)

Github stars Tracking Chart

Sinon.JS

独立和测试框架无关的 JavaScript 测试侦探、桩和模拟(发音为“sigh-non”,Sinon,战士)。

兼容性

有关兼容性和浏览器支持的详细信息,请参见 COMPATIBILITY.md

安装方法

通过 npm

$ npm install sinon

或者通过 sinon 的浏览器构建,可以在主页上下载。也有一些基于 npm 的 CDN 可以使用。

使用方法

参见 sinon 项目主页上的使用文档。

如果你有文档中没有涉及的问题,你可以 在Stack Overflow 上查看 sinon 标签,或者在 irc.freenode.net:6667 上随便访问 #sinon.js。

你也可以在 Sinon.JS 邮件列表档案中搜索。

目标

  • 无全局污染
  • 使用方便
  • 要求最低限度的 "一体化"
  • 易于与任何测试框架无缝嵌入。
  • 轻松伪造任何接口
  • 为 XMLHttpRequest、定时器等提供随时可用的 fakes。

贡献?

请参阅 CONTRIBUTING.md 了解如何为 Sinon.JS 做出贡献。

许可证

Sinon.js 在 BSD-3 下发布。


(The first version translated by vz on 2020.08.30)

Main metrics

Overview
Name With Ownersinonjs/sinon
Primary LanguageJavaScript
Program languageJavaScript (Language Count: 3)
PlatformLinux, Mac, Web browsers, Windows
License:Other
所有者活动
Created At2010-06-29 21:15:32
Pushed At2025-06-13 05:10:18
Last Commit At
Release Count217
Last Release Namev20.0.0 (Posted on 2025-03-24 19:22:03)
First Release Name0.5.0 (Posted on 2010-08-09 23:41:25)
用户参与
Stargazers Count9.7k
Watchers Count90
Fork Count769
Commits Count3.7k
Has Issues Enabled
Issues Count1369
Issue Open Count40
Pull Requests Count1091
Pull Requests Open Count4
Pull Requests Close Count189
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private

Better docs?

Do you wish that Sinon had better documentation?

So do we!

With your support, we can improve the documentation for everyone.

  1. Donate to the campaign for better documentation
  2. Spread the word of the campaign in your companies and on social media

Thank you!

Compatibility

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

Installation

via npm

$ npm install sinon

or via sinon's browser builds available for download on the homepage. There are also npm based CDNs one can use.

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 or drop by #sinon.js on irc.freenode.net:6667.

You can also search through the Sinon.JS mailing list archives.

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 XMLHttpRequest, timers and more

Contribute?

See CONTRIBUTING.md for details on how you can contribute to Sinon.JS

Backers

Support us with a monthly donation and help us continue our activities. [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