babel-plugin-module-resolver icon indicating copy to clipboard operation
babel-plugin-module-resolver copied to clipboard

Jest mocks not having an effect

Open henrikbjorn opened this issue 6 years ago • 1 comments

Hey all

Currently trying to get jest mocks working together with this plugin. I have tried different variations of jest.mock.

Here is my test:

// @flow
import mainframeClient from 'phon/mainframeClient'

jest.mock('phon/mainframeClient')
//jest.mock(require.resolve('phon/mainframeClient'))

describe('mainframe', () => {
  it('test', () => {
    // Not a mock
    console.log(mainframeClient)

    // This creates a mock correctly
    console.log(jest.genMockFromModule('phon/mainframeClient'))
  })
})

henrikbjorn avatar Jan 04 '19 08:01 henrikbjorn

Hi @henrikbjorn ...I am also struggling with this problem. Did you find a solution in the end?

matt-dalton avatar Dec 22 '21 12:12 matt-dalton