sinon icon indicating copy to clipboard operation
sinon copied to clipboard

Name differences

Open henit opened this issue 7 years ago • 3 comments

It might be logical reasons that I don't know about, but I wonder about some of the name differences between sinon-methods:

spy.notCalledWith assert.neverCalledWith

Should they have the same name?

stub.callsFake stub.callsArg stub.callsArgWith stub.callThrough stub.callArg stub.callArgWith

I often end up checking the docs where there is 'calls*' and where there is 'call*'.

henit avatar Aug 03 '17 06:08 henit

Thank you for pointing it out!

I agree, there should be more consistency in naming.

I think an approach like this could work:

  • create a README or wiki page, describing the naming conventions
  • rename all methods that do not follow the naming conventions
  • add deprecation warnings to all deprecated method names
  • publish new version
  • in a later MAJOR version, remove the deprecated methods

Do you want to take a stab at it?

mroderick avatar Aug 03 '17 06:08 mroderick

That sounds like a good approach.

I think Sinon is a very good library, and would very much like to contribute to it if possible. Unfortunately, there is no room for this at the moment, hopefully it will change soon.

henit avatar Aug 03 '17 12:08 henit

Related discussion in #1000.

mantoni avatar Aug 03 '17 13:08 mantoni