Git Product home page Git Product logo

Comments (3)

stalniy avatar stalniy commented on May 26, 2024

@keithamus @meeber probably I can share my vision of chai spies:

Robust, easy to use library with nice chai integration

Few reasons why I don't like sinon:

  • too much terms with different methods (stub, spy, whatever)
  • in order to use sinon you need to go through the whole docs and eventually you will not find answer to your question.
  • integrates badly with chai. in chai each word separated with dot but with sinon and sinon-chai you will write something like expect(spy).to.have.been.calledWith what looks odd in context of other specs

On the other hand chai-spies something intuitive, you dont need much docs. Just few methods. And then it's easy to guess like:

const spy = chai.spy()
const returnFive = chai.spy.returns(5) // so, you write what you need: `spy returns 5` I haven't seen more obvious way to do it in js frameworks
const array = []
chai.spy.on(array, 'push') 
expect(array.push).not.to.have.been.called()

const interface = chai.spy.object({ run: null })
expect(interface.run).not.to.have.been.called()

Also I think the main goal of this ticket is to change README file to highlight this.

Does it make sense?

from chai-spies.

keithamus avatar keithamus commented on May 26, 2024

@meeber do you have any thoughts on this?

from chai-spies.

meeber avatar meeber commented on May 26, 2024

I think it's clear that some people prefer chai-spies over sinon-chai, and that the features being requested recently can be implemented without sacrificing the qualities that make them prefer chai-spies. So, more power to this plugin!

from chai-spies.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.