AngularJS karma——无法启动单元测试

AngularJS karma——无法启动单元测试,angularjs,unit-testing,karma-jasmine,Angularjs,Unit Testing,Karma Jasmine,我正在尝试为angular controller编写示例单元测试。但测试失败,并显示错误消息: Error: Unknown provider: $$rAFProvider from ngMock at Error (native) at c:/eclipse/workspace/Ecomm-Fron-End/WebContent/js/assets/vendor/angularjs/angular.min.js:28:338 at Objec

我正在尝试为angular controller编写示例单元测试。但测试失败,并显示错误消息:

  Error: Unknown provider: $$rAFProvider from ngMock
        at Error (native)
        at c:/eclipse/workspace/Ecomm-Fron-End/WebContent/js/assets/vendor/angularjs/angular.min.js:28:338
        at Object.c [as get] (c:/eclipse/workspace/Ecomm-Fron-End/WebContent/js/assets/vendor/angularjs/angular.min.js:26:104)
        at Object.j.$provide.decorator (c:/eclipse/workspace/Ecomm-Fron-End/WebContent/js/assets/vendor/angularjs/angular.min.js:28:217)
        at c:/eclipse/workspace/Ecomm-Fron-End/WebContent/js/assets/vendor/angularjs/angular-mocks.js:1746:12
        at Object.d [as invoke] (c:/eclipse/workspace/Ecomm-Fron-End/WebContent/js/assets/vendor/angularjs/angular.min.js:26:320)
        at c:/eclipse/workspace/Ecomm-Fron-End/WebContent/js/assets/vendor/angularjs/angular.min.js:25:107
        at Array.forEach (native)
        at m (c:/eclipse/workspace/Ecomm-Fron-End/WebContent/js/assets/vendor/angularjs/angular.min.js:6:193)
        at e (c:/eclipse/workspace/Ecomm-Fron-End/WebContent/js/assets/vendor/angularjs/angular.min.js:24:398)
    TypeError: Cannot read property 'testName' of undefined
        at null.<anonymous> (c:/eclipse/workspace/Ecomm-Fron-End/WebContent/js/assets/test/sample.js:18:18)

我已经检查过,angular和angular模拟文件版本相同(v1.2.19)

您是否缺少任何依赖项,如
angular animate.js
或类似的内容?你能发布你的因果报应配置吗?不,我没有遗漏任何一个。你能发布你的
homeCtrl
源代码吗?
describe('Unit: homeCtrl', function() {
  // Load the module with MainController
  beforeEach(module('yourMarketApp'));

   var ctrl, scope;

  beforeEach(inject(function($controller, $rootScope) {
    // Create a new scope that's a child of the $rootScope
    scope = $rootScope.$new();
    // Create the controller
    ctrl = $controller('homeCtrl', {
      $scope: scope
    });
  }));

   it('should test scope.testName', 
    function() {
        expect(scope.testName).toEqual("");
  });

});