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

Découvrez les meilleurs dépôts open-source grâce à notre recherche par IA.

ExplorerRecherches sélectionnéesAlternatives open sourceLogiciels auto-hébergésBlogPlan du site
ProjetServeur MCPÀ proposNotre méthodologiePresse
Mentions légalesConfidentialitéConditions d'utilisation
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
·
sinonjs avatar

sinonjs/sinon

0
View on GitHub↗
9,753 stars·793 forks·JavaScript·15 vuessinonjs.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.

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.
  • Frameworks de test - Mocking library with spies, stubs, and mocks.

Historique des stars

Graphique de l'historique des stars pour sinonjs/sinonGraphique de l'historique des stars pour sinonjs/sinon

Recherche par IA

Explorez plus de dépôts awesome

Décrivez vos besoins en langage naturel — l'IA classe des milliers de projets open source sélectionnés par pertinence.

Start searching with AI

Questions fréquentes

Que fait sinonjs/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.

Quelles sont les fonctionnalités principales de sinonjs/sinon ?

Les fonctionnalités principales de sinonjs/sinon sont : Mocking Frameworks, Controlled Interface Fakes, Test Double Implementations, Argument Constraint Matchers, Method Interception Proxies, Test-Time, Interaction Verification Utilities, Fake Timers.

Quelles sont les alternatives open-source à sinonjs/sinon ?

Les alternatives open-source à sinonjs/sinon incluent : 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…

Alternatives open source à Sinon

Projets open source similaires, classés selon le nombre de fonctionnalités partagées avec Sinon.
  • phpspec/prophecyAvatar de phpspec

    phpspec/prophecy

    8,480Voir sur 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
    Voir sur GitHub↗8,480
  • sapegin/jest-cheat-sheetAvatar de sapegin

    sapegin/jest-cheat-sheet

    5,428Voir sur 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
    Voir sur GitHub↗5,428
  • vitest-dev/vitestAvatar de vitest-dev

    vitest-dev/vitest

    15,970Voir sur 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
    Voir sur GitHub↗15,970
  • jasmine/jasmineAvatar de jasmine

    jasmine/jasmine

    15,824Voir sur 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
    Voir sur GitHub↗15,824
Voir les 30 alternatives à Sinon→