1
我收到錯誤性質「$範圍」:摩卡 - 類型錯誤:無法讀取的不確定
類型錯誤:在$控制器無法讀取屬性未定義
「$範圍」(bower_components /角/ angular.js :10327:28)
at bower_components/angular-mocks/angular-mocks.js:2221:12
at Context。 (src/client/app/peer-review/post-visit.controller.spec.js:11:18)
在帶有摩卡和業力的angularJS控制器上運行測試時。
測試它正試圖運行的初始化是:
describe('PostVisitController', function() {
var controller;
beforeEach(function() {
bard.appModule('app.peer-review');
bard.inject('$controller', '$log');
controller = $controller('PostVisitController');
});
bard.verifyNoOutstandingHttpRequests();
it('should be created successfully', function() {
expect(controller).to.be.defined;
});
});
控制器,它正在測試不需要$範圍,測試在同一模塊中通過精細其它控制器。