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
Our Free Plans just got better! | Auth0 Icon
Our Free Plans just got better! | Auth0

With up to 25k MAUs and unlimited Okta connections, our Free Plan lets you focus on what you do best—building great apps.

You asked, we delivered! Auth0 is excited to expand our Free and Paid plans to include more options so you can focus on building, deploying, and scaling applications without having to worry about your security. Auth0 now, thank yourself later.
Try free now
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