首页 > 其他分享 >[Jest] Override original module file with requireActual

[Jest] Override original module file with requireActual

时间:2022-12-22 16:12:41浏览次数:45  
标签:requireActual Jest originalModule module filename jest

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

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

 

标签:requireActual,Jest,originalModule,module,filename,jest
From: https://www.cnblogs.com/Answer1215/p/16998984.html

相关文章