Auto-mocking entire module with sinon

23 Views Asked by At

I'm writing unit test and I'm new to testing and coding. I'm using supertest and sinon when testing. I'm using a function inside app.ts and everytime I test using supertest, function executes. I want to prevent that function from executing so I need to mock an entire module like jest.mock("toyourpath").

I tried jest and it worked but I need to do it with sinon. How can I do it using Sinon. I tried using sinon.mock() but it does not change the object. How can I do that or is it possible with sinon?

0

There are 0 best solutions below