npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sinon-chai-in-order

v0.1.0

Published

A Chai plugin providing assertions on the order of Sinon spy calls

Downloads

2,326

Readme

In-Order Sinon-Chai Assertions

Build Status

Dependency Status devDependency Status

Motivation

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);
expect(spy.getCall(0).args[0]).to.equal(1);
expect(spy.getCall(1).args[0]).to.equal(2);
expect(spy.getCall(2).args[0]).to.equal(3);

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

expect(spy).inOrder.to.have.been.calledWith(1)
                   .subsequently.calledWith(2)
                   .subsequently.calledWith(3);

Setup

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';

chai.use(sinonChai);
chai.use(sinonChaiInOrder);

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:

chai.use(require('chai-react-element').default);

Contributing

Setup

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).

Issues

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.