Relative Content

Tag Archive for node.jsmultithreadingjestjsmockingsinon

How to globally mock/stub function even for worker thread

I have NodeJS project and tests via jest.
In quite a lot of places, the project calls some common function. Let’s call it myCommonModule.myCommonFunction. That function cannot be executed during tests. It needs to be stubbed. I do that simply with sinon like so