Standalone test spies, stubs and mocks for JavaScript. Works with any unit testing framework. As before, Sinon.JS provides utilities that help test frameworks reduce the boiler-plate. As of Sinon 10 we stopped maintaining compatibility with legacy browsers. Instead, we focus on compatibility with evergreen browsers, Node.js LTS versions and recent Safari versions. The most up-to-date reference on which runtimes and browsers we support can be found by looking at our compatibility docs. Fake timers are synchronous implementations of setTimeout and friends that Sinon.JS can overwrite the global functions with to allow you to more easily test code using them. A test spy is a function that records arguments, return value, the value of this and exception thrown (if any) for all its calls. There are two types of spies: Some are anonymous functions, while others wrap methods that already exist in the system under test. Mocks should only be used for the method under test.

Features

  • General setup, fakes, spies, and stubs
  • Mocks, spy calls, promises, and fake timers
  • Fake XHR and server, JSON-P, and Assertions
  • Matchers, sandboxes, and utils
  • If you need to support old runtimes you can try Sinon 9
  • Compatibility with evergreen browsers and Node.js LTS versions

Project Samples

Project Activity

See All Activity >

License

BSD License

Follow Sinon.JS

Sinon.JS Web Site

Other Useful Business Software
MongoDB Atlas runs apps anywhere Icon
MongoDB Atlas runs apps anywhere

Deploy in 115+ regions with the modern database for every enterprise.

MongoDB Atlas gives you the freedom to build and run modern applications anywhere—across AWS, Azure, and Google Cloud. With global availability in over 115 regions, Atlas lets you deploy close to your users, meet compliance needs, and scale with confidence across any geography.
Start Free
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of Sinon.JS!

Additional Project Details

Programming Language

JavaScript

Related Categories

JavaScript Software Testing Tool, JavaScript Frameworks, JavaScript Unit Testing Tool

Registered

2021-07-07