OSS TanbouSign in with GitHub

use framework-agnostic spies, stubs, mocks, and fake timers to test JavaScript behavior

About these scores

OSS scale score is an unbounded metric that log-compresses and weights Stars, Watchers, Forks, and Contributors. Discovery score is the current OSS scale score minus the score at discovery. Update pace is commits in the last 30 days, growth momentum is the OSS scale score difference within the recent observation window, and OSS health is a 0–100 rating based on available recency, Community Health, and release data.

Stars
9,756
Primary language
JavaScript
License
BSD-3-Clause
Repository last updated
Oct 5, 2026
On this page

Overview

Sinon is a standalone JavaScript testing library for spies, stubs, and mocks. It can be added to an existing test framework to observe function calls, replace dependencies, verify expectations, and fake time-dependent behavior.

Features and best fit

Based on official documentation; not hands-on tested · Content checked:

Key features

Use spies, stubs, and mocks without replacing the test framework

The README describes Sinon as standalone and test-framework agnostic, so projects can add the required test doubles to an existing runner.

Sources: [1]

Use ready-made fake timers for time-dependent code

Shipping ready-to-use timer fakes is listed as a project goal, helping tests separate time-dependent behavior from real elapsed time.

Sources: [1]

Best fit

Fits unit tests that need selective control over dependencies and calls

Sinon is useful when an existing test stack needs focused spying, stubbing, mocking, or timer control rather than a replacement testing framework.

Sources: [1]

Before adoption

Version 22.1.0 is an ES module package, so verify module resolution

The package declares type: module and exposes both import and require paths. Check the test runner and bundler configuration used by an existing codebase.

Sources: [2][3]

Official sources

  1. [1]Sinon v22.1.0 README(2026-10-06)
  2. [2]Sinon v22.1.0 package metadata(2026-10-06)
  3. [3]Sinon v22.1.0 changelog(2026-10-06)
  4. [4]Sinon BSD-3-Clause license(2026-10-06)
Supplemental curator note

Sinon fits unit tests that need selective call observation, dependency replacement, or timer control without replacing the existing test runner. Version 22.1.0 is an ES module package, so verify module resolution in the current toolchain.

Try it in 3 steps

  1. 1

    Get the source

    git clone --depth 1 https://github.com/sinonjs/sinon.git
  2. 2

    Enter the repository

    cd sinon
  3. 3

    Check the official steps

    Continue with the commands in the README Installation, Quick Start, or Getting Started section.

    find . -maxdepth 1 -iname 'README*' -exec sed -n '1,220p' {} \; -quit
Check the official README

Growth

Growth trends · Last 30 days

9,756 Stars

Trend data is still being collected.

Built with

Categories and tags

Categories

GitHub data

GitHub dataView detailed GitHub data

GitHub Topics

  • javascript
  • sinon
  • stub
  • stubs
  • tdd
  • test-driven-development
  • test-spies
  • unit-testing
Stars
9,756
Forks
807
Watchers
94
Open issues
69
Owner type
Organization
Primary language
JavaScript
Repository last updated
Oct 5, 2026
Write a related article

Share a guide or use case for this OSS in Markdown. Articles are published after administrator approval.

Report incorrect information

Tell us if any listing information is incorrect or outdated.

After reading this page, do you know what to do next?