[Jest] Override original module file with requireActual

jest.mock('./filename', () => {
  const originalModule = jest.requireActual('./filename')

  return {
    ...originalModule,
    fnA: jest.fn(),
    fnB: (b: boolean): boolean => b,
  }
})

 

posted @ 2022-12-22 16:06  Zhentiw  阅读(21)  评论(0编辑  收藏  举报