I am using sinon to make my tests, and I faced a problem that I can’t find a proper solution
lets say, for simplicity, that I want, when I call console.log()
,that the proper console.log
receives the argument that I want in my test.
I have tryied:
Sinon.replace( console, 'log', () => console.log('mytestparam'))
Sinon.stub( console, 'log').callsFake( console.log('mytestparam'))
But it creates some kind of circular dependency that crashes
I cant simply make a full stub of the function, because it contains code that I want to run, I only want to replace the argument used for the call.
I have researched the sinon docs but I can’t find any function that allows to call the original function changing the args
Any idea?