-
-
Notifications
You must be signed in to change notification settings - Fork 771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backwards incompatible change for sinon.createStubInstance between version 1.17 and 1.16 #860
Comments
There was a bug in 1.17.0. Can you make sure you have 1.17.1 installed? |
I have tested in 1.17.1 and it behaves the same. |
This broke all my tests when upgrading to 1.17.1 from 1.16.1 |
starting with 1.17 |
more context: #795 |
I just checked the documentation again and I think it's short and to the point:
@sterlinghw @skyle143 I think your test cases used to work coincidentally, but it was never an intention that the result of I'm tempted to close this, but as it's failing existing test cases, I'd like to hear if @cjohansen, @mroderick or @fatso83 have more thoughts to add? |
My only complaint it that the functionality changed and should have been a major version bump to not break existing tests. I actually prefer the new behavior. |
Like @skyle143 mentioned, my main point is that it's a non-backwards-compatible change. Since I assume that a minor version bump will not introduce backwards incompatible changes, I ran into this issue. I would think that this could hurt others coding under this same assumption. |
Agree with Kyle on the principle of bumping the major version as it is a On the other hand, should we invest more efforts into the 1.x branch, or
|
I vote for bumping the major version (publish from |
I understand the problem a lot better after trying to fix #867. Essentially, classes where never stubbed at all in Sinon 1.16. Using I would even argue that it could have been a patch to fix the missleading behavior where |
It may be "wrong" behavior in 1.16 to not have any methods stubbed on the class object, but regardless, if people are relying on this behavior, the api shouldn't change. Simply upgrading sinon from a minor version bump should never break tests. |
I understand your point, and it's generally valid. But we didn't change any semantics and we repaired a broken behavior. In this particular case, you're asking to bump the major because your tests where relying on a bug in Sinon. If you see that it's not doing the right thing and then rely on it anyway, we can't support that. |
Thanks for explaining @mantoni, I agree with you. |
It looks like
createStubInstance
does not work the same in version 1.17 when compared to 1.16. I have two examples of usingcreateStubInstance
, but each example only works in their respective versions.works in 1.17
works in 1.16
Notice the differences for stubbing
foo
.sinon.stub(mock, 'foo').returns('baz')
throwsTypeError: Attempted to wrap foo which is already wrapped
in 1.17 andmock.foo.returns('baz')
throwsTypeError: mock.foo.returns is not a function
in 1.16.Apparently, 1.17 stubs each of the methods when creating an instance whereas 1.16 did not.
The text was updated successfully, but these errors were encountered: