Closed
Description
Describe the bug
Starting from [email protected], using returns
clears fake's callArgAt
.
This means that the callback will not be called.
To Reproduce
Run the following:
const sinon = require("sinon");
const assert = require("assert");
const stub = sinon.stub();
stub.callsArgWith(0, "Hello").returns("World");
const cb = sinon.stub();
const ret = stub(cb);
assert.strictEqual(ret, "World");
assert(cb.calledOnce);
assert.deepEqual(cb.firstCall.args, ["Hello"]);
Expected behavior
The callback should be properly invoked.
Context (please complete the following information):
- Library version: 17.0.1
- Environment: Windows / Node.JS
Additional context
Bug introduced by the fix for #2566 (see #2567).
Might be fixed by removing this line but this needs validation.