Elestia Open Source Ratings
6.9

Sinon.JS

Reasonable, with limits. 5th of 10 mocking and test data.

Sinon.JS is the long-standing standalone library for spies, stubs, mocks and fake timers, and it works with any test runner. It is still maintained and is a solid pick for Mocha or node:test suites. Projects on Vitest or Jest already get the same features built in, and Sinon cannot stub native ES module exports.

Best for: Teams on Mocha, node:test or another runner without built-in mocks who want mature spies, stubs and fake timers that work with any framework.

WebsiteGitHubnpm

Scores

Overall6.9

How strongly do we recommend it for a new project today?

Claude Opus 5.5: 6.0, likely 5.0 to 7.0

Sinon is a mature, safe and maintained choice that does its narrow job well, and it is the best pick for spies and stubs outside Jest and Vitest. For most new projects the test runner's built-in mocks cover the same job with less setup and better ESM handling. Its growth trails the category. It is a reasonable choice with real limits, not the default.

GPT-6.2 Sol: 7.8, likely 6.7 to 8.8

Sinon is a strong pick for new projects that need detailed function stubbing and clock control across runners. Active maintenance and long-running downstream integrations support that choice, while slower relative adoption and upgrade regressions lower confidence. Vitest is simpler when a team already uses it and needs module mocks, and Mock Service Worker is the better fit for HTTP interception.

Needed by many5.9

How many developers need a tool for this job?

Claude Opus 5.5: 5.0, likely 4.0 to 6.5

Faking functions in unit tests is a very common need. But most new JS and TS projects use Vitest or Jest, which already include spies and stubs. Sinon's own audience is mainly users of Mocha, node:test and other runners, plus older suites. The range stays wide because the share of non-Jest and non-Vitest projects is hard to pin down.

GPT-6.2 Sol: 6.7, likely 5.6 to 7.8

Spies, stubs, and fake clocks are useful across frontend and backend testing, and Sinon works with multiple runners. Many teams already get these tools from Jest, Vitest, or Cypress. The survey measures testing tool use, so the share of developers who need a separate mocking library is uncertain.

Helps a lot7.4

How well does it do the job for those who need it?

Claude Opus 5.5: 6.5, likely 5.5 to 7.5

Its API for spies, stubs, mocks, matchers, sandboxes and fake timers is mature and complete, and coding agents know it well. Clear limits keep it out of the top band: it cannot stub ES module namespaces, its TypeScript types live outside the package, and its assertions are wordier than expect()-style matchers. Recent releases kept fixing correctness edge cases, for example making callId isolated per sandbox.

GPT-6.2 Sol: 8.3, likely 7.1 to 9.1

Sinon 22.1 offers precise stubs, call assertions, and fake clocks, with examples for common setups and clear errors for some invalid calls. Native ES module stubbing takes extra setup, and TypeScript support comes from a separate package. The documentation gives coding agents concrete patterns to follow, while comparative speed and agent accuracy remain uncertain.

Holds up over time7.1

Will it still be a good choice in two years?

Claude Opus 5.5: 6.5, likely 5.5 to 7.5

The project is active: 117 commits and 8 npm versions in the last year, version 22.1.0 in July 2026, and a Scorecard Maintained score of 10. A few long-time volunteers do the work and no funding is visible. The ecosystem is drifting towards the mocks built into test runners. Majors arrive yearly with removals, and the 21.1 ESM rewrite shipped regressions that later releases fixed. GitHub Releases is stale (v4.2.2 from 2018), but npm and the changelog are current.

GPT-6.2 Sol: 7.6, likely 6.5 to 8.6

Sinon had 117 commits and eight npm versions in the past year. The npm record and changelog show active releases despite the stale GitHub Releases listing. Two maintainers published recent versions, LFX reports a one-day median response, and Open Collective records ongoing sponsorship. Recent patch regressions, a four-month gap since the latest npm release, and competition from built-in mocks make the two-year outlook less certain.

Used widely7.1

How many use it, and is that growing?

Claude Opus 5.5: 7.0, likely 6.0 to 8.0

Use is very large: about 55M downloads in four weeks and 372k dependent repos, the most in the category. Growth is weak, though. Its download ratio of about 1.58 is far below the 4.1 median, so it is losing share while MSW and Faker climb. Much of its use comes from old Mocha codebases rather than new choices.

  • npm downloadsLast4Weeks: 54.9M, against 34.7M a year ago (ratio about 1.58, below the 4.1 median)
  • dependents repos: 372,404 repos and 70,717 packages, the most of any peer
  • bluesky posts: 0 posts, so little current buzz

GPT-6.2 Sol: 7.2, likely 6.0 to 8.3

The indexed 372,404 repositories and 70,717 npm packages show substantial use, with the highest repository count among the listed peers. Four-week downloads rose from 34.7 million to 54.9 million, but the 1.58× ratio trails the catalog’s 4.1× median and MSW’s 4.68×. That signals a loss of relative ground, while automated installs and packages that pull in Sinon make fresh direct adoption hard to estimate.

Vouched for6.9

Who stands behind it being good?

Claude Opus 5.5: 6.0, likely 5.0 to 7.5

Many large projects have relied on Sinon for years, and its fake-timers package is built into Vitest and Jest, which is strong indirect endorsement. Current independent praise is thin: there are no Hacker News or Bluesky mentions, and the State of JS results we found do not single it out. Comparison write-ups recommend it only for setups without Jest or Vitest.

GPT-6.2 Sol: 7.8, likely 6.6 to 8.8

Cypress builds its spies, stubs, and clock commands on Sinon, and Microsoft lists Sinon in the VS Code test stack. The AWS SDK client mock also relies on it, and Jest and Vitest use its separate fake-timers package. Several of these integrations use older releases or only the timer component, so they give limited evidence about satisfaction with Sinon 22.1.

Safe7.7

How safe is it to depend on?

Claude Opus 5.5: 8.0, likely 7.0 to 9.0

There are no advisories, only 4 dependencies (all inside the sinonjs organisation), and the permissive BSD-3-Clause licence. The Scorecard is 7.5 overall, with weak checks for Security-Policy, CII-Best-Practices and Fuzzing, and releases are not signed. It is a dev dependency, which lowers the impact of any problem.

  • advisories total: 0 advisories
  • scorecard score: 7.5; Security-Policy 0, CII 0, Fuzzing 0
  • npm dependencies: 4 dependencies; BSD-3-Clause licence

GPT-6.2 Sol: 7.4, likely 6.0 to 8.6

Sinon has four direct dependencies, a permissive BSD-3-Clause license, and zero direct advisories in the OSV snapshot. The current release uses a patched version of diff after an earlier dependency report. The 7.5 Scorecard shows strong workflow permissions but flags missing security policy and fuzzing, and the project documents a manual npm publish step. Release attestations remain unverified, and LFX flags two serious findings whose package scope is unclear.

Good

  • It works with any test runner, so the same stubs, spies and sandboxes run under Mocha, node:test, Jasmine or Karma.
  • Its matchers (sinon.match) are rich and composable, and sandboxes restore many stubs in one call.
  • Its fake timers (@sinonjs/fake-timers) are so solid that Vitest and Jest use them internally, and they now cover the Temporal API.
  • It pulls in only 4 dependencies, has no known advisories and uses the permissive BSD-3-Clause licence.

Bad

  • It cannot stub named exports of native ES modules. You need dependency injection or a loader-based tool such as testdouble or esmock.
  • It ships no TypeScript types of its own, so typings come from the separately maintained @types/sinon.
  • Vitest and Jest include vi.fn and jest.fn, so many new projects never need it, and its downloads are growing more slowly than the category's.
  • Majors land every year with removals such as fakeServer and fake XHR in v20, and the 21.1 ESM migration brought regressions that later patches had to fix.

The numbers

npm downloads, 4 weeks
55M +58% in a year
GitHub stars
9.8k
Commits, 12 months
117
npm version
22.1.0 Jul 2026
Versions, 12 months
8
Advisories, 24 months
0 of 0 ever
OpenSSF Scorecard
7.5 out of 10, Nov 2026
Licence
BSD-3-Clause

Read on 21 November 2026 from GitHub (sinonjs/sinon), npm (sinon), OSV and the OpenSSF Scorecard.

Mocking and test data

  1. 8.5Mock Service Worker
  2. 8.1Faker
  3. 7.1Nock
  4. 6.9Mockttp
  5. 6.9Sinon.JS
  6. 6.5Fishery
  7. 5.7fetch-mock
  8. 5.6JSON Server
  9. 5.4testdouble.js
  10. 4.1Mirage JS
Compare all 10 on six scores