Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To pass arguments through a Sinon stub, you can use the callsFake method along with an anonymous function that takes arguments.

Example:

const myStub = sinon.stub();
myStub.callsFake((arg1, arg2) => {
  // do something with arg1 and arg2
});

Then, when you call myStub with arguments, the anonymous function will be called with those arguments.