So I have a base class that has a following function: public handleError(){ //some code } Now I'm writing test case for my child component that inherits it and due to some chain of event it actually goes through the above method and returns an error. How can I override/stub this method? I tried stub() and callFake to try to hijack this method but the execution still passes though the one defined in base class: it('Should call super ngOnInit()', async () => { const { instance } = await shallow.render(); spyOn(instance, 'handleError').and.callFake(()=>{ return "error" }); //spyOn(service, 'myMethod').and.stub(); const SuperNgOnInitSpy = spyOnSuper(ListBase, 'ngOnInit'); instance.ngOnInit(); expect(SuperNgOnInitSpy).toHaveBeenCalled(); }); Continue reading...