Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sinon

Package Overview
Dependencies
Maintainers
2
Versions
208
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sinon - npm Package Versions

1
1921

1.5.2

Diff

Changelog

Source

1.5.2

  • Revert stub.reset changes that caused existing tests to fail.
cjohansen
published 1.5.0 •

Changelog

Source

1.5.0

  • Don't force "use strict" on Sinon consumers
  • Don't assume objects have hasOwnProperties. Fixes problem with e.g. stubbing properties on process.env
  • Preserve function length for spy (Maximilian Antoni)
  • Add 'invokeCallback' alias for 'yield' on calls (Maximilian Antoni)
  • Added matcher support for calledOn (Maximilian Antoni)
  • Retain original expectation messages, for failed mocks under sinon.test (Giorgos Giannoutsos)
  • Allow yields* and callsArg* to create sequences of calls. (Domenic Denicola)
  • sinon.js can catch itself in endless loop while filling stub prototype with asynch methods (Jan Kopriva)
cjohansen
published 1.4.2 •

Changelog

Source

1.4.2

  • sinon.match for arrays (Maximilian Antoni)
cjohansen
published 1.4.1 •

Changelog

Source

1.4.1

  • Strengthen a Node.JS inference to avoid quirky behavior with Mocha (which provides a shim process object)
cjohansen
published 1.4.0 •

Changelog

Source

1.4.0

  • Argument matchers (Maximilian Antoni) sinon.match.{any, same, typeOf, instanceOf, has, hasOwn, defined, truthy, falsy} as well as typeOf shortcuts for boolean, number, string, object, function, array, regexp and date. The result of a call can be used with spy.calledWith.
  • spy.returned now works with matchers and compares objects deeply.
  • Matcher assertions: calledWithMatch, alwaysCalledWithMatch and neverCalledWithMatch
  • calledWithNew and alwaysCalledWithNew for assert (Maximilian Antoni)
  • Easier stubbed fluent interfaces: stub.returnsThis() (Glen Mailer)
  • allow yields() and family to be used along with returns()/throws() and family (Glen Mailer)
  • Async versions callsArg* and yields* for stubs (TEHEK)
  • Format args when doing spy.printf("%*") (Domenic Denicola)
  • Add notCalled property to spies
  • Fix: spy.reset did not reset fakes created by spy.withArgs (Maximilian Antoni)
  • Properly restore stubs when stubbing entire objects through the sandbox (Konrad Holowinski)
  • Restore global methods properly - delete properties that where not own properties (Keith Cirkel)
  • setTimeout and setInterval pass arguments (Rodion Vynnychenko)
  • Timer callbacks that contain a clock.tick no longer fails (Wesley Waser)
  • spy(undefined, "property") now throws
  • Prevent multiple restore for fake timers (Kevin Decker)
  • Fix toString format under Node (Kevin Decker)
  • Mock expectations emit success and failure events (Kevin Decker)
  • Development improvement: Use Buster.JS to test Sinon
  • Fix bug where expect.atLeast failed when minimum calls where received
  • Make fake server safe to load on node.js
  • Add support for no args on .withArgs and .withExactArgs (Tek Nynja)
  • Avoid hasOwnProperty for host objects
cjohansen
published 1.3.4 •

cjohansen
published 1.3.3 •

cjohansen
published 1.3.2 •

Changelog

Source

1.3.2

  • Stronger Node inference in sandbox
  • Fixed issue with sinon.useFakeTimers() and Rhino.js 1.7R3
  • Formatting brush-up
  • FIX Internet Explorer misreporting the type of Function objects originating in an external window as "object" instead of "function".
  • New methods stub.callsArgOn, stub.callsArgOnWith, stub.yieldsOn, stub.yieldsToOn
  • Implemented
  • Fixing clearTimeout to not throw when called for nonexistent IDs.
  • Spys that are created using 'withArgs' now get initialized with previous calls to the original spy.
  • Minor bug fixes and docs cleanup.
cjohansen
published 1.3.1 •

Changelog

Source

1.3.1

  • Fix bug in core sinon: isNode was used for both a variable and a function, causing load errors and lots of bugs. Should have never left the door.
cjohansen
published 1.3.0 •

Changelog

Source

1.3.0

  • Support using bare functions as fake server response handlers (< 1.3.0 required URL and/or method matcher too)

  • Log some internal errors to sinon.log (defaults to noop). Set sinon.log to your logging utility of choice for better feedback when.

  • White-list fake XHRs: Allows some fake requests and some that fall through to the backend server (Tim Ruffles)

  • Decide Date.now support at fake-time. Makes it possible to load something that polyfills Date.now after Sinon loaded and still have Date.now on fake Dates.

  • Mirror properties on replaced function properties

  • New methods: spy.yield(), spy.yieldTo(), spy.callArg() and spy.callArgWith() can be used to invoke callbacks passed to spies (while avoiding the mock-like upfront yields() and friends). invokeCallback is available as an alias for yield for people working with strict mode. (Maximilian Antoni)

  • New properties: spy.firstCall, spy.secondCall, spy.thirdCall and spy.lastCall. (Maximilian Antoni)

  • New method: stub.returnsArg(), causes stub to return one of its arguments. (Gavin Huang)

  • Stubs now work for inherited methods. This was previously prohibited to avoid stubbing not-yet-implemented methods. (Felix Geisendörfer)

  • server.respond() can now accept the same arguments as server.respondWith() for quick-and-dirty respondWith+respond. (Gavin Huang)

  • Format objects with buster-format in the default bundle. Default to util.inspect on node unless buster-format is available (not a hard dependency, more like a 'preference').

  • Bug fix: Make sure XHRs can complete even if onreadystatechange handler fails

  • Bug fix: Mirror entire Date.prototype, including toUTCString when faking

  • Bug fix: Default this object to global in exposed asserts

  • Bug fix: sinon.test: use try/finally instead of catch and throw - preserves stack traces (Kevin Turner)

  • Bug fix: Fake setTimeout now returns ids greater than 0. (Domenic Denicola)

  • Bug fix: NPM install warning (Felix Geisendörfer)

  • Bug fix: Fake timers no longer swallows exceptions (Felix Geisendörfer)

  • Bug fix: Properly expose all needed asserts for node

  • Bug fix: wrapMethod on window property (i.e. when stubbing/spying on global functions)

  • Bug fix: Quote "yield" (Ben Hockey)

  • Bug fix: callOrder works correctly when spies have been called multiple times

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc