-
-
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
Incorrect returnValue when using withArgs() and firstCall or lastCall #1487
Comments
This is a great issue description! Thank you for taking the time to fill it out. The testcase makes an excellent candidate for Will run the test case when given some time. |
kbtknr
pushed a commit
to kbtknr/sinon
that referenced
this issue
Jul 18, 2017
brian-mann
added a commit
to cypress-io/sinon
that referenced
this issue
Jul 26, 2017
* commit '4a40f80b79f3f74558e2c7c5890cc299ea276984': Use property of this, not variable Rename variable name Fix sinonjs#1487: incorrect withArgs().returnValue
chrisbreiding
added a commit
to cypress-io/sinon
that referenced
this issue
Jul 27, 2017
chrisbreiding
added a commit
to cypress-io/sinon
that referenced
this issue
Jul 28, 2017
franck-romano
pushed a commit
to franck-romano/sinon
that referenced
this issue
Oct 1, 2019
franck-romano
pushed a commit
to franck-romano/sinon
that referenced
this issue
Oct 1, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Related to: #1478 and #1476
What did you expect to happen?
It should not matter how the stub is queried, i.e., getCall(0), firstCall or lastCall should all return the same value if there is only one call using withArgs().
In version 2.3.5, this test succeeds, but when updating to any version above it (tested it with 2.3.8), the test will fail.
What actually happens
The test fails when using
withArgs()
together withfirstCall.returnValue
orlastCall.returnValue
. But somehow, when usinggetCalls(0).returnValue
orreturnValues[0]
, it does work.How to reproduce
Given the following test case (sorry, it's in TypeScript).
The inject stub will return a different fake component function based on the arguments that are passed. The return value of the inject stub is then used for example to check the arguments passed etc.
The text was updated successfully, but these errors were encountered: