diff --git a/src/sinon/default-behaviors.js b/src/sinon/default-behaviors.js index df5a00a76..82368b667 100644 --- a/src/sinon/default-behaviors.js +++ b/src/sinon/default-behaviors.js @@ -145,6 +145,7 @@ const defaultBehaviors = { returns: function returns(fake, value) { fake.callsThrough = false; fake.returnValue = value; + fake.returnArgAt = undefined; fake.resolve = false; fake.reject = false; fake.returnValueDefined = true; diff --git a/test/src/stub-test.js b/test/src/stub-test.js index adc016925..157026f44 100644 --- a/test/src/stub-test.js +++ b/test/src/stub-test.js @@ -721,6 +721,15 @@ describe("stub", function () { assert.equals(obj.fn("myarg"), "myarg"); }); + it("is superseded by returns", function () { + const stub = createStub(); + + stub.returnsArg(0); + stub.returns(42); + + assert.equals(stub("myarg"), 42); + }); + it("throws if no index is specified", function () { const stub = createStub();