[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 @   Zhentiw  阅读(21)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
历史上的今天:
2021-12-22 [AWS SOA] Route 53
2019-12-22 [Algorithm] 617. Merge Two Binary Trees
2019-12-22 [Algorithm] 905. Sort Array By Parity
2018-12-22 [Algorithms] Divide and Recurse Over an Array with Merge Sort in JavaScript
2017-12-22 [Recompose] Create Stream Behaviors to Push Props in React Components with mapPropsStream
2017-12-22 [Recompose] Stream Props to React Children with RxJS
2017-12-22 [Recompose] Merge RxJS Button Event Streams to Build a React Counter Component
点击右上角即可分享
微信分享提示