属性 andCallThrough() 在类型 jasmine.spy 的值上不存在

The property andCallThrough() does not exist on the value of type jasmine.spy

    it('should call getCompany on the people service when getCompany is called',

        function () {
            spyOn(peopleService, 'requestPeople').andCallThrough();

            scope.getCompany();

            deferred.resolve();

            scope.$root.$digest();

            expect(peopleService.requestPeople).toHaveBeenCalled();
        });

    it('should populate the peopleList when getCompany is called',

        function () {
            scope.getCompany();

            deferred.resolve();

            scope.$root.$digest();

            expect(scope.peopleList).not.toBe([]);
        });

我有一段模拟服务的代码,但出现错误 如前所述 above.Any 有人面临同样的问题?有任何修复吗?

检查您使用的 Jasmine 版本。

.andCallThrough()用于Jasmine 1.3,你应该在Jasmine 2.x

中使用.and.callThrough()