# sinonjs/sinon

Test spies, stubs and mocks for JavaScript.

Repository: https://github.com/sinonjs/sinon
Canonical: https://ross.abutalabs.com/products/sinon
Homepage: https://sinonjs.org/
Language: JavaScript
License: NOASSERTION
License Family: other
Topics: stubs, javascript, tdd, test-driven-development, unit-testing, sinon, stub, test-spies
Last push: 2026-08-05T17:16:30+00:00

## Health v2 (maintenance only)
Score: 66/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 96, release rhythm 8, longevity 100
- inputs: {"age_days": 5909, "days_push": 28, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_license
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 9758, forks 803 (observed 2026-08-28T04:10:37.082804+00:00)

## What it is
Sinon.JS is a standalone, test framework agnostic JavaScript library providing test spies, stubs, mocks, and fake timers. It integrates seamlessly with any unit testing framework such as Mocha, Jest, Jasmine, or tap.

## Use cases
- spy on function calls in JavaScript unit tests
- stub dependencies in unit tests
- mock API methods for testing
- fake timers to test time-dependent code
- create test doubles without a specific test framework
- replace module functions during tests

## When to choose
- you need spies, stubs, or mocks in JavaScript tests
- you want a test framework agnostic mocking library
- you need fake timers for testing async or scheduled code
- you want minimal integration with your existing test runner

## When to avoid
- you need module-level mocking of ES module imports (consider proxyquire or testdouble.js)
- your test framework already provides built-in mocking you prefer
- you are testing non-JavaScript languages

## Facets
- artifact type: library
- maturity: stable
- function: testing, mocking
- domain: testing, developer-tools
- platform: browser, cross-platform
- tags: test-spies, stubs, mocks, fake-timers, tdd, unit-testing, test-framework-agnostic, javascript, nodejs

## Member repositories
- sinonjs/sinon (main) score 66

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:10:37.082804+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:21:11.464955+00:00, confidence not recorded.
  - readme: https://github.com/sinonjs/sinon (fetched 2026-08-28T04:10:37.082804+00:00, sha 54f5390196dd)
  - homepage: https://sinonjs.org/ (fetched 2026-08-29T08:21:05.174016+00:00, sha bb6687c21280)
  - site_page: https://sinonjs.org/getting-started (fetched 2026-08-29T08:21:05.183048+00:00, sha 5fab335ecf98)
  - site_page: https://sinonjs.org/guides/faq (fetched 2026-08-29T08:21:05.184753+00:00, sha 83b6fe121a24)
- Data as of 2026-08-30T08:39:29.467469+00:00.
