Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 8, 2024 via pnpm

sinon 17.0.1

JavaScript test spies, stubs and mocks.
Package summary
Share
0
issues
3
licenses
7
BSD-3-Clause
6
MIT
1
(Unlicense OR Apache-2.0)
Package created
20 Dec 2010
Version published
1 Nov 2023
Maintainers
4
Total deps
14
Direct deps
6
License
BSD-3-Clause

Issues

0
This package has no issues

Licenses

BSD 3-Clause "New" or "Revised" License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
place-warranty
Cannot
use-trademark
hold-liable
Must
include-copyright
include-license
7 Packages, Including:
@sinonjs/commons@2.0.0
@sinonjs/commons@3.0.1
@sinonjs/fake-timers@11.2.2
@sinonjs/samsam@8.0.0
diff@5.2.0
nise@5.1.9
sinon@17.0.1

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
6 Packages, Including:
has-flag@4.0.0
just-extend@6.2.0
lodash.get@4.4.2
path-to-regexp@6.2.2
supports-color@7.2.0
type-detect@4.0.8

(Unlicense OR Apache-2.0)

Public Domain
1 Packages, Including:
@sinonjs/text-encoding@0.7.2
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

6
All Dependencies CSV
β“˜ This is a list of sinon 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
@sinonjs/commons3.0.110.39 kBBSD-3-Clause
prod
@sinonjs/fake-timers11.2.218.66 kBBSD-3-Clause
prod
@sinonjs/samsam8.0.020.53 kBBSD-3-Clause
prod
diff5.2.0419.27 kBBSD-3-Clause
prod
nise5.1.9254.43 kBBSD-3-Clause
prod
supports-color7.2.03.13 kBMIT
prod

Visualizations

Frequently Asked Questions

What does sinon do?

Sinon is a standalone and testing-framework agnostic JavaScript library used for creating test spies, stubs and mocks. Designed to be easy to use and easily integrated with any testing framework, Sinon helps developers fake any interface and ships with ready-to-use fakes for XMLHttpRequest, timers and more, without causing global pollution.

How do you use sinon?

Sinon can be installed via npm with the command npm install sinon. It can also be accessed via its browser builds available for download on the homepage, or through the npm based CDNs available. However, the specific details on how to use Sinon depend on the needs of your project and the testing framework you are using. In general, you would use Sinon to create and manage spies, stubs, and mocks for your testing suite, a very high-level example might look something like this in your Javascript test file:

const sinon = require('sinon');
let callback = sinon.spy();
let proxy = new Proxy({}, {
  get: function(target, property) {
    if (property in target) {
      return target[property];
    } else {
      callback(property);
      return function() {};
    }
  }
});

proxy.hello();
console.log(callback.calledWith('hello')); // true

Where are the sinon docs?

The main source for Sinon documentation is the Sinon project homepage. The official Sinon website contains a comprehensive guide on how to use Sinon, including usage examples and detailed explanations of concepts. In case of additional questions not covered by the documentation, one can check out the sinon tag on Stack Overflow or drop by #sinon.js on irc.freenode.net:6667. The Sinon.JS mailing list archives can also provide valuable historical information and discussions about the package.