We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug sinon.createStubInstance was extended recently to allow overrides such as:
sinon.createStubInstance
sinon.createStubInstance(AClass, { aMethod: "a string", aChainableMethod: sinon.stub().returnsThis() });
Theres a small issue which prevents a user from returning null values
To Reproduce
sinon.createStubInstance(AClass, { aMethod: null });
Expected behavior The library should correctly create a stub instance with a stub method returning null
Reason Theres an initial check whether the override is a stub by checking if createStubInstance property exists on the return value https://github.com/sinonjs/sinon/blob/master/lib/sinon/stub.js#L85
createStubInstance
This throws when we try to check a property of null
Context (please complete the following information):
Thanks! Let me know if it makes sense, I can help create a PR for it
The text was updated successfully, but these errors were encountered:
Thank you for your detailed analysis of the bug, it looks like an interesting one! A pull request would be very welcome 👍
Sorry, something went wrong.
sinonjs#1957: check for truthiness before checking whether optional o…
c51809f
…verride is a stub
#1957: check for truthiness before checking whether optional override…
aec059f
… is a stub
8735077
No branches or pull requests
Describe the bug
sinon.createStubInstance
was extended recently to allow overrides such as:Theres a small issue which prevents a user from returning null values
To Reproduce
Expected behavior
The library should correctly create a stub instance with a stub method returning null
Reason
Theres an initial check whether the override is a stub by checking if
createStubInstance
property exists on the return value https://github.com/sinonjs/sinon/blob/master/lib/sinon/stub.js#L85This throws when we try to check a property of null
Context (please complete the following information):
Thanks!
Let me know if it makes sense, I can help create a PR for it
The text was updated successfully, but these errors were encountered: