0
的時候,這裏是用於測試的IndexController參數的IndexController不是一個函數,得到了不確定的:運行因緣測試
//modules/application/tests/spec/controllers/IndexController.js
'use strict';
(function() {
describe('Application IndexController', function() {
beforeEach(function() {
module('HtEwa');
module('HtEwa.Application');
});
var scope, IndexController;
beforeEach(inject(function($controller, $rootScope) {
scope = $rootScope.$new();
IndexController = $controller('IndexController', {
$scope: scope
});
}));
it('should expose global scope', function() {
expect(scope.global).toBeTruthy();
});
});
})();
我看到其他的答案,但它不是爲我工作我的測試文件。我有包括在我karma.conf.js文件是:
files:_.flatten(_.values(assets.core.js)).concat([
'modules/*/*.js',
'modules/*/*/*.js',
'modules/*/tests/spec/*/*.js'
]);
我有HtEwa
和HtEwa.Application
模塊。在HtEwa.Application
下有IndexController。
//modules/application/controllers/IndexController.js
'use strict';
angular.module('HtEwa.Application').controller('IndexController', ['$scope', 'Global',
function($scope, Global) {
$scope.global = Global;
}
]);
我想這不包括我的IndexController文件,但我已經列入我karma.conf.js
modules/*/*/*.js
,這就是其中的IndexController is.Or我失去了什麼?
編輯: 而業力--log-level debug
表明,所有需要的文件服務。 這裏有包含的文件,我從鉻看了
<!-- Dynamically replaced with <script> tags -->
<script type="text/javascript" src="/base/node_modules/karma-jasmine/lib/jasmine.js"></script>
<script type="text/javascript" src="/base/node_modules/karma-jasmine/lib/adapter.js"></script>
<script type="text/javascript" src="/base/bower_components/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="/base/bower_components/angular/angular.js"></script>
<script type="text/javascript" src="/base/bower_components/angular-mocks/angular-mocks.js"></script>
<script type="text/javascript" src="/base/bower_components/angular-cookies/angular-cookies.js"></script>
<script type="text/javascript" src="/base/bower_components/angular-resource/angular-resource.js"></script>
<script type="text/javascript" src="/base/bower_components/angular-ui-router/release/angular-ui-router.js"></script>
<script type="text/javascript" src="/base/bower_components/angular-bootstrap/ui-bootstrap.min.js"></script>
<script type="text/javascript" src="/base/bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js"></script>
<script type="text/javascript" src="/base/modules/application/application.js"></script>
<script type="text/javascript" src="/base/modules/application/controllers/FooterController.js"></script>
<script type="text/javascript" src="/base/modules/application/controllers/HeaderController.js"></script>
<script type="text/javascript" src="/base/modules/application/controllers/IndexController.js"></script>
<script type="text/javascript" src="/base/modules/application/init.js"></script>
<script type="text/javascript" src="/base/modules/application/routes/ApplicationRoutes.js"></script>
<script type="text/javascript" src="/base/modules/application/services/Global.js"></script>
<script type="text/javascript" src="/base/modules/application/services/HTTPInterceptor.js"></script>
<script type="text/javascript" src="/base/modules/application/tests/spec/controllers/IndexController.js"></script>
<script type="text/javascript" src="/base/modules/users/controllers/UserController.js"></script>
<script type="text/javascript" src="/base/modules/users/routes/Auth.js"></script>
<script type="text/javascript" src="/base/modules/users/services/UserService.js"></script>
<script type="text/javascript" src="/base/modules/users/tests/spec/controllers/UserController.js"></script>
<script type="text/javascript" src="/base/modules/users/users.js"></script>
<script type="text/javascript">
window.__karma__.loaded();
</script>
我已經添加,現在它顯示另一個錯誤:'錯誤:[$注射器:nomod]模塊'HtEwa.Users'是不可用嘞!您錯誤地 拼寫模塊名稱或忘記加載它。如果註冊模塊確保你指定依賴關係作爲第二個參數。' – bring2dip 2014-09-27 07:58:24
什麼是錯誤 – ryeballar 2014-09-27 07:58:47
,我已經在modules/users/users.js中定義了該模塊 – bring2dip 2014-09-27 07:59:47