awesome-repositories.com
Blog
MCP
awesome-repositories.com

Discover the best open-source repositories with AI-powered search.

ExploreCurated searchesOpen-source alternativesSelf-hosted softwareBlogSitemap
ProjectMCP serverAboutHow we rankPress
LegalPrivacyTerms
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
sinonjs avatar

sinonjs/sinon

0
View on GitHub↗
sinonjs.org↗

Sinon

Sinon is a JavaScript test double library and mocking framework used to isolate code and verify behavior during unit testing. It provides a collection of spies, stubs, and mocks that replace real function implementations and object methods with controlled substitutes.

The project includes a specialized fake timer library for overriding the system clock, allowing the simulation of time progression to trigger timeouts and intervals without waiting for real-time delays. It also features a test sandbox mechanism to group multiple fakes together, ensuring the original state is restored between test cases to prevent environment leakage.

The toolkit covers a broad range of verification capabilities, including recording function call arguments and invocation counts, simulating dependency behaviors through predefined return values or errors, and verifying object interactions. It further supports intercepting network requests and stubbing object instances and accessors.

AI search

Explore more awesome repositories

Describe what you need in plain English — the AI ranks thousands of curated open-source projects by relevance.

Start searching with AI

Features

  • Mocking Frameworks - Serves as a comprehensive framework for creating simulated objects and stubbing method calls.
  • Controlled Interface Fakes - Allows replacing function implementations to return specific values or trigger errors for controlled testing.
  • Test Double Implementations - Implements a comprehensive set of spies, stubs, and mocks to replace real dependencies.
  • Argument Constraint Matchers - Provides logic for validating function call arguments against custom predicates and constraints during assertions.
  • Method Interception Proxies - Uses dynamic proxy systems to wrap original methods and record metadata or control return values.
  • Test-Time - Returns specific values, throws errors, or resolves promises by overriding existing functions.
  • Interaction Verification Utilities - Enables recording and asserting that object methods are called with expected arguments and in the correct order.
  • Fake Timers - Trigger timeouts and intervals instantly by replacing the system clock with a fake timer to avoid waiting for real time.
  • Function Call Tracking - Maintains an internal ledger of arguments, contexts, and return values for every invocation of a wrapped function.
  • Function Behavior Replacement - Simulates specific dependencies by intercepting function calls and returning predefined values or throwing errors.
  • Test Isolation - Prevents test leakage by grouping multiple fakes into a sandbox that restores the original state.
  • Global Object Interception - Implements the replacement of native JavaScript clock and timer functions to simulate time progression.
  • Mocking and Spying Libraries - Provides a full toolkit of spies, stubs, and mocks for isolation and interaction tracking.
  • Object Interaction Verification - Checks that specific methods on an object are called with expected arguments and in the correct order.
  • Dependency Mocking - Replaces module dependencies and network calls with controlled substitutes to simulate specific behaviors.
  • Timer Mocks - Allows overriding native timers to control time-based execution and trigger timeouts instantly.
  • Test Sandbox Restoration - Ships a sandbox mechanism that tracks all modified properties and restores original behavior via a single cleanup call.
  • Test Spying Utilities - Tracks function call arguments, return values, and invocation counts to verify object interactions.
  • Virtual Time Testing - Simulates the passage of time by overriding the system clock to trigger timers without waiting in real-time.
  • Accessor Stubbing - Controls or monitors access to specific properties by replacing getters and setters on objects.
  • Fake Timer Utilities - Offers a specialized library to override the system clock for instant timeout and interval triggering.
  • Mock Expectation Definitions - Provides syntax for defining anticipated method calls and return sequences on mock objects.
  • API Request Mocking - Mocks server responses and inspects outgoing requests by simulating a network environment.
  • Test State Sandboxes - Includes a sandbox mechanism to group fakes and automatically restore original behavior between tests.
  • Instance-Level Stubbing - Replaces every method in a constructor instance with a stub to simulate a full object.
  • Instance Stubbing - Provides the ability to intercept object instantiation and automatically stub every method of the resulting instance.
  • Unit Testing - Provides the essential tooling for isolating units of code and verifying their logic in JavaScript.
  • Assertions and Coverage - Spies, stubs, and mocks for JavaScript testing.
  • Testing and Quality Assurance - Test spies, stubs, and mocks for JavaScript.
  • Testing Frameworks - Mocking library with spies, stubs, and mocks.
9,753 stars·793 forks·JavaScript·36 views

Star history

Star history chart for sinonjs/sinonStar history chart for sinonjs/sinon

How this analysis was created: This summary and feature list are AI-generated from collected project material and can contain mistakes. Stars, license and language are imported from GitHub. Inclusion does not mean that we have tested or audited this project. Check the source documentation for any feature you depend on. Learn more on our About page.

Frequently asked questions

What does sinonjs/sinon do?

Sinon is a JavaScript test double library and mocking framework used to isolate code and verify behavior during unit testing. It provides a collection of spies, stubs, and mocks that replace real function implementations and object methods with controlled substitutes.

What are the main features of sinonjs/sinon?

The main features of sinonjs/sinon are: Mocking Frameworks, Controlled Interface Fakes, Test Double Implementations, Argument Constraint Matchers, Method Interception Proxies, Test-Time, Interaction Verification Utilities, Fake Timers.

Which projects share features with sinonjs/sinon?

Projects with overlapping indexed features include: phpspec/prophecy — Prophecy is a PHP mocking framework and test double library used to simulate object dependencies during unit testing.… sapegin/jest-cheat-sheet — This project is a comprehensive reference guide and cheat sheet for the Jest testing framework. It provides technical… vitest-dev/vitest — Vitest is a high-performance testing framework designed for JavaScript and TypeScript applications. It provides an… jasmine/jasmine — Jasmine is a JavaScript testing framework and test runner designed for behavior-driven development. It provides a… moq/moq4 — Moq4 is a .NET mocking framework used to create simulated implementations of interfaces and abstract classes. It… jestjs/jest — Jest is a JavaScript testing framework designed for writing and running automated test suites to verify the…

Projects sharing features with Sinon

These projects share indexed features with Sinon. Shared tags can include platform or build tooling; verify the primary use case before treating a result as a replacement.
  • phpspec/prophecyphpspec avatar

    phpspec/prophecy

    8,480View on GitHub↗

    Prophecy is a PHP mocking framework and test double library used to simulate object dependencies during unit testing. It serves as a behavioral testing tool for creating mocks, stubs, and dummies to isolate code and ensure predictable test results. The framework enables interaction verification by tracking method call counts and arguments to validate that specific interactions occurred. It supports defining specific return values or custom logic for method calls to simulate various execution scenarios. The library provides capabilities for argument matching based on type or value, interactio

    PHP
    View on GitHub↗8,480
  • sapegin/jest-cheat-sheetsapegin avatar

    sapegin/jest-cheat-sheet

    5,428View on GitHub↗

    This project is a comprehensive reference guide and cheat sheet for the Jest testing framework. It provides technical documentation and syntax examples for writing JavaScript unit tests, focusing on assertions, mocking strategies, and test suite configuration. The resource details specific methods for dependency isolation and mocking, including the use of fake timers, module-level substitutions, and function call verification. It also covers specialized workflows such as snapshot testing to detect regressions via serialized output comparisons. The guide further addresses asynchronous test pa

    cheatsheetjesttesting
    View on GitHub↗5,428
  • vitest-dev/vitestvitest-dev avatar

    vitest-dev/vitest

    15,970View on GitHub↗

    Vitest is a high-performance testing framework designed for JavaScript and TypeScript applications. It provides an integrated environment that supports unit, integration, and browser-based testing, allowing developers to execute test suites natively without requiring separate build steps or complex configuration. The project distinguishes itself through a highly optimized execution model that leverages worker-thread isolation and on-demand module transformation to provide rapid feedback. It includes a comprehensive suite of mocking and spying utilities that allow for the interception of depen

    TypeScripttesttesting-toolsvite
    View on GitHub↗15,970
  • jasmine/jasminejasmine avatar

    jasmine/jasmine

    15,824View on GitHub↗

    Jasmine is a JavaScript testing framework and test runner designed for behavior-driven development. It provides a comprehensive toolset for writing and executing descriptive test suites that verify code behavior in both web browsers and Node.js environments. The framework is distinguished by its integrated mocking library, which allows for dependency isolation through spies and stubs, as well as the ability to simulate time and timing functions to test asynchronous logic synchronously. It also includes a mechanism to enforce test uniqueness, preventing duplicate names for tests and suites. I

    JavaScript
    View on GitHub↗15,824
Compare all 30 related projects→