I have mocked a third party library using jest.genMockFromModule('winston');
from this point on wherever I require winston
, if I console.log(winston)
the mocked functions are also coming. But it should come only in the test case file only.
What am I doing wrong here?
__mocks__
winston.js
const winston = jest.genMockFromModule('winston');
logger.js
const winston = require('winston')
console.log(winston) // object consist of mockFunctions