Stubs - Sinon. JS As of Sinon version 1 8, you can use the onCall method to make a stub respond differently on consecutive calls Note that in Sinon version 1 5 to version 1 7, multiple calls to the yields* and callsArg* family of methods define a sequence of behaviors for consecutive calls
API documentation - Sinon. JS As of Sinon 10 we stopped maintaining compatibility with legacy browsers Instead, we focus on compatibility with evergreen browsers, Node js LTS versions and recent Safari versions The most up-to-date reference on which runtimes and browsers we support can be found by looking at our compatibility docs
Spies - Sinon. JS sinon spy(object) Spies all the object’s methods Note that it’s usually better practice to spy individual methods, particularly on objects that you don’t understand or control all the methods for (e g library dependencies)
Assertions - Sinon. JS To make sure assertions integrate nicely with your test framework, you should customize either sinon assert fail or sinon assert failException and look into sinon assert expose and sinon assert pass The assertions can be used with either spies or stubs
Mocks - Sinon. JS To see what mocks look like in Sinon JS, here is one of the PubSubJS tests again, this time using a method as callback and using mocks to verify its behavior
Releases - Sinon. JS Their addressing schemes vary, but an example url such as https: cdn jsdelivr net npm sinon@3 pkg sinon js would download the latest browser bundle of Sinon 3
Sandboxes - Sinon. JS Since Sinon 5, the sinon object is a default sandbox in itself! Unless you have a very advanced setup or need a special configuration, you probably only need to use that one in your tests for easy cleanup