Sinon.JS

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

Github星跟踪图

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)

主要指标

概览
名称与所有者sinonjs/sinon
主编程语言JavaScript
编程语言JavaScript (语言数: 3)
平台Linux, Mac, Web browsers, Windows
许可证Other
所有者活动
创建于2010-06-29 21:15:32
推送于2025-06-13 05:10:18
最后一次提交
发布数217
最新版本名称v20.0.0 (发布于 2025-03-24 19:22:03)
第一版名称0.5.0 (发布于 2010-08-09 23:41:25)
用户参与
星数9.7k
关注者数90
派生数769
提交数3.7k
已启用问题?
问题数1369
打开的问题数40
拉请求数1091
打开的拉请求数4
关闭的拉请求数189
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?

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