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
Custom VMs From 1 to 96 vCPUs With 99.95% Uptime Icon
Custom VMs From 1 to 96 vCPUs With 99.95% Uptime

General-purpose, compute-optimized, or GPU/TPU-accelerated. Built to your exact specs.

Live migration and automatic failover keep workloads online through maintenance. One free e2-micro VM every month.
Try 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