Sinon.JS: runner-agnostic test doubles whose repository points elsewhere for docs and release notes
Test spies, stubs and mocks for JavaScript.
At a glance
- What is it?
- Sinon.JS gives JavaScript tests spies, stubs, mocks and timer fakes without tying them to one test framework. The package is at version 22.1.0, but its GitHub README carries no API examples and its GitHub Releases list stops in 2018, so a reader has to know where the real information sits.
- Who is it for?
- Sinon.JS fits teams that want spies, stubs, mocks and timer fakes that stay independent of their test runner, and who are comfortable reading the API on sinonjs.org rather than in the repository. It is a poor match for anyone who tracks upgrades through GitHub Releases, because that list ends at v4.2.2 from January 2018 while the package is at 22.1.0.
- Can I use it commercially?
- Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
- Is it still maintained?
- Yes. The repository received new commits within the last day.
- What is it written in?
- Mainly JavaScript, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.
Star history
- sinonjs/sinon9,752 ★ · -4
| Repository | 2026-09-30 | 2026-11-15 |
|---|---|---|
| sinonjs/sinon | 9.8k | 9.8k |
-4 Stars in the last 46 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
Spies, stubs and mocks with no test runner attached
Sinon.JS describes itself as standalone and test framework agnostic: it supplies test spies, stubs and mocks for JavaScript and leaves the choice of runner, reporter and assertion style to you. Its stated goals are short and concrete: no global pollution, easy to use, minimal integration, embedding into any testing framework, faking any interface, and shipping ready-to-use fakes for timers. The keyword list in package.json fills in the rest of the surface area: spy, stub, fake, mock, clock, time, xhr and assert.
The agnostic design has a practical meaning for adoption. Nothing about Sinon requires a particular runner. The project's own suite runs under mocha, through the test-node script that executes `mocha --recursive -R dot` over `test/{src,issues,scripts}`, but that is the maintainers' choice for testing Sinon itself, not a dependency pushed onto users. The name, pronounced "sigh-non", comes from Sinon, the warrior of Greek legend.
Two delivery paths: the npm package and the pkg/ browser build
There are two ways to get Sinon. The first is npm:
npm install sinonThe second is a browser build shipped inside the package's `pkg/` directory. Because it is part of the published npm package, npm-based CDNs serve it directly: jsDelivr at https://cdn.jsdelivr.net/npm/sinon/pkg/sinon.js and unpkg at https://unpkg.com/sinon/pkg/sinon.js. The project also links a cdnjs listing for sinon.js.
The browser build is not an afterthought in the test setup. package.json carries a `test-pkg-browser-global` script that runs a browser-global smoke test and a `test-pkg-browser-esm` script that checks the ESM bundle is runnable, so both a script-tag global and an ES module form of the bundle are exercised.
One cost to note: neither CDN URL above contains a version number. Copied as printed, they do not pin a release. With the package already at major version 22, anything long-lived that loads Sinon from a CDN should add an explicit version to the URL before relying on it.
The README sends you to sinonjs.org for the API
The repository README contains no usage examples at all. Under its Usage heading it says only to see the project homepage, https://sinonjs.org/, for documentation, and to check the `sinon` tag on Stack Overflow for questions the documentation does not cover. There is no snippet showing how to create a stub, wrap a method with a spy or install the fake clock.
The consequence is concrete. Someone evaluating Sinon from its npm page or its GitHub repository sees installation instructions, project goals and sponsor logos, but cannot judge the API shape without leaving for the website. Work that happens offline, or inside a review that only looks at the repository, has nothing to go on. The repository does contain a `docs/` directory at its root, which is the place to look if you need the material alongside the code.
Compatibility is handled the same way. The README does not state supported browsers or Node versions inline; it points to COMPATIBILITY.md. If your project targets older runtimes, open that file before installing rather than discovering a mismatch in CI.
GitHub Releases stop at v4.2.2 while package.json says 22.1.0
The most recent entries on the repository's Releases list are three tags from January 2018: v4.2.2 ("Make resetHistory work for props", January 26, 2018), v4.2.1 ("Speed up stub creation") and v4.2.0 ("Add match.every and match.some"). The package.json on the default branch, meanwhile, declares version 22.1.0.
That gap is not a sign of abandonment. The repository is not archived, and its last push was on October 29, 2026. It means the GitHub Releases feed is not where versions are announced. Any tooling that watches GitHub Releases for update notifications will report nothing newer than 4.2.2, and anyone who opens the Releases tab to read upgrade notes between majors will find notes for a version that is many majors behind.
The repository root carries CHANGES.md, which is the file to open for change history, along with RELEASE.md. When moving between majors, read CHANGES.md for each version you cross instead of relying on the Releases page.
A git checkout has no lib/ until you build it
The `lib/` directory is generated build output and is not committed to the repository. A fresh clone therefore contains the sources under `src/`, the tests under `test/`, and build configuration such as `build.cjs` and `rollup.config.mjs`, but not the built files. To regenerate `lib/` locally, the project gives this command:
npm run buildThe test scripts handle this step for themselves. In package.json, `pretest-node` and `pretest-headless` both run `npm run build-artifacts`, which runs `node ./build.cjs`, and `test-coverage` and `test-cloud` run the same step before doing their own work.
The consequence falls on anyone who browses the repository on GitHub expecting to read the shipped code under `lib/`, or who wants to point at a checkout of the source: there is nothing there until a build runs. Read `src/` for the source, and build first if you need the generated output.
One license, three different labels
Sinon's license is reported three ways depending on where you look. GitHub's repository metadata shows NOASSERTION, meaning GitHub's detection did not settle on a single license identifier. The package.json `license` field says BSD-3-Clause. The README's closing line says Sinon.js was released under BSD-3 and links to the LICENSE file.
For most developers this is a non-issue: the package.json field and the README agree on BSD-3. The consequence lands on teams with automated license compliance. A scanner that reads GitHub's repository metadata rather than the npm package can flag Sinon as having no declared license and block it in a dependency review. If that happens, the LICENSE file in the repository root is the document to hand to whoever approves the exception, with the package.json value as supporting evidence.
The test scripts show which runtimes the build is checked against
package.json is a useful map of what the maintainers verify. Beyond `test-node`, there is `test-headless` and `test-webworker`, both of which call `scripts/run-browser-suite.mjs` with a mode argument, so the suite runs in a headless browser and inside a web worker. `test-esm-support` runs a module support assessment, `test-esm-browser-build` checks that the ESM bundle runs, `test-distribution` runs a distribution check, and `test-cloud` hands off to `scripts/test-cloud.sh`. Coverage comes from `test-coverage`, which drives mochify with the puppeteer driver under nyc.
The project also uses artifact-first contract tests, described in CONTRIBUTING.md, to protect public APIs during migration. That is a direct signal that changes to the public surface are guarded against accidental breakage.
One piece of public evidence is missing, though. The README hides its Sauce Labs browser badge in a comment because it shows an outdated result, and says it will not be fixed until a pull request in sinonjs/fake-timers (number 395) ships. Until then, there is no live browser matrix on the README, and COMPATIBILITY.md is the reference for browser support.
Editorial conclusion
Sinon.JS fits teams that want spies, stubs, mocks and timer fakes that stay independent of their test runner, and who are comfortable reading the API on sinonjs.org rather than in the repository. It is a poor match for anyone who tracks upgrades through GitHub Releases, because that list ends at v4.2.2 from January 2018 while the package is at 22.1.0. Before adopting it, read COMPATIBILITY.md for your target browsers and Node versions, and read CHANGES.md for the version you install.
Frequently asked questions
What is Sinon?
Sinon.JS is a standalone, test framework agnostic library of test spies, stubs and mocks for JavaScript. It also ships ready-to-use fakes for timers.
How do I use Sinon?
Install it with npm install sinon, or load the browser build from the package's pkg/ directory through a CDN such as jsDelivr or unpkg. Usage documentation lives on https://sinonjs.org/, and the README points to the sinon tag on Stack Overflow for questions the docs do not cover.
How do I use a Sinon stub?
The Sinon README does not include stub examples; it directs readers to the documentation at https://sinonjs.org/ for usage of stubs, spies and mocks.
What does the name Sinon mean for Sinon.JS?
Sinon.JS is named after Sinon, the warrior of Greek legend, and the project gives the pronunciation as "sigh-non".
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/sinonjs-sinon)Star history chart for your README
[](https://hysenlabs.com/projects/sinonjs-sinon)Was this useful?