jest 中如何 mock 类其中的部分函数?`
import { Recorder, Pubsub } from "trident"; const pubsub = new Pubsub(); export class SmartRecorder extends Recorder { constructor(props) { super(props); } start() { pubsub.subscribe('androidData', androidDataHandler); return super.start(); } }
使用 mockImplementation 方式,提示 类型“typeof Recorder”上不存在属性“mockImplementation” 用 as转换后无效。 使用 jest.requireActual,直接没法运行。
试了两天搜了很多方法都不行,请问下大佬们怎么编写啊?