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
Ship Agents Faster Icon
Ship Agents Faster

Transform your applications and workflows into powerful agentic systems at global scale.

Gemini Enterprise Agent Platform lets you rapidly build, scale, govern and optimize production-ready agents grounded in your organization's data. The platform enables developers to build custom or pre-built agents for virtually any use case. New customers get $300 in free credits.
Get Started 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