I mock a javascript class in a file using jest.mock('./blabla.js')
. The file blabla.js
exports a new instance of the class when imported per default (export default new BlaBla()
). That class has several methods in it. I want to use original implementation of just one (or some) of these methods, but I want to continue using mocks of other methods. Is it ever possible on jest?
There is a similar question asked for nodejs here: Jest: How to mock one specific function when using module.exports. But if I tried to adapt this solution to my test spec, it simply didn't work.