In-Order Sinon-Chai Assertions

Build Status

Dependency Status devDependency Status


Sinon-Chai provides Chai assertions for Sinon.JS. Unfortunately, it does not deal with making sure a spy was called multiple time in a specific order. This can result in awkward, non-fluent assertions:

var spy = sinon.spy();
[1, 2, 3].forEach(spy);

Using sinon-chai-in-order, you can say this instead:



In Node, just install using npm:

$ npm install sinon-chai-in-order

In your tests, have Chai use the plugin. Make sure you also use sinon-chai, otherwise the nested assertions will not work.

import chai, {expect} from 'chai';
import sinonChai from 'sinon-chai';
import sinonChaiInOrder from 'sinon-chai-in-order';


This plugin is distributed in UMD format so you can use it everywhere. However, it is exported as an ES6 module. If using ES5, please use:




This project uses Gulp for build and tests, and webpack-dev-server for running and debugging in-browser. To install the project, just run npm install.

To start the development environment, run npm start, or, if you have Gulp installed globally, gulp dev. This runs tests using Mocha and in addition starts webpack-dev-server on port 8080. To run the tests, use npm test (or gulp test).


Please open an issue on the project’s GitHub repo for any problem you might find. Please refrain from creating pull requests before discussing your problem in an issue.

Pull Requests

Please try to develop your submission using Test-Driven Development. At the very least, make sure that your changes are well-covered with tests, and that your code is clean.