Jasmine matchers for Sinon.JS
I have written a small plugin for the Jasmine BDD JavaScript testing framework to allow for better integration with the Sinon.JS spying, stubbing and mocking library.
Using Sinon.JS with Jasmine means you end up writing slightly unhelpful expectations. Here is a simple spec involving a Sinon spy:
The jasmine-sinon plugin creates custom matchers for Jasmine, so that you can do this instead:
This means that your specs read better, but you also get better failure output from the Jasmine spec runner. Instead of:
Expected false to be truthy.
the output is:
Expected Function to have been called with 'foo'.
The plugin is at version 0.1, and needs some further testing. It is also missing any exception matchers. Please fork at will.
Jasmine-sinon plugin on Github.