MockService still causes error: Cannot read property 'subscribe' of undefined
问题 I'm new to Angular testing. So, I was following this pluralsight course. I keep getting the same error Cannot read property 'subscribe' of undefined no matter what I do. describe('AnnualReportComponent', () => { let fixture: ComponentFixture<AnnualReportComponent>; let mockReportService; let REPORTITEMS = [ { id: 1, title: 'title 1' }, { id: 2, title: 'title 2' }, { id: 3, title: 'title 3' } ] beforeEach(() => { mockReportService = jasmine.createSpyObj('ReportService', ['getAnnualReport']);