Angularjs 使用karma/jasmine时角度模块不可用

Angularjs 使用karma/jasmine时角度模块不可用,angularjs,karma-jasmine,Angularjs,Karma Jasmine,我正试图从我的项目中测试一个控制器,我得到一个模块未找到错误。我看过类似的问题/答案,但解决方案对我来说并不奏效 我的角度代码如下: angular.module('atMain') .controller('MainController', ['$scope', 'atDirApi', 'atServer', '$sce', '$filter','$routeParams', '$location', '$window', function($scope, atDirApi, a

我正试图从我的项目中测试一个控制器,我得到一个模块未找到错误。我看过类似的问题/答案,但解决方案对我来说并不奏效

我的角度代码如下:

angular.module('atMain')
   .controller('MainController', ['$scope', 'atDirApi', 'atServer', '$sce', '$filter','$routeParams', '$location', '$window', 
   function($scope, atDirApi, atServer, $sce, 
       $filter, $routeParams, $location, $window) {
       /* controller functions attached to $scope here*/
   }]);
我的业力测试看起来像:

describe('', function() {
    var MainCtrl;
    beforeEach(module("atMain"));
    beforeEach(inject(function($controller) {
        MainCtrl = $controller("MainController");
    }));

    it('should showImage to !showImage', function() {
        var $scope = {};
        var controller = $controller('MainController', { $scope: $scope }); 
        $scope.showImage = false;
        $scope.showFunc();

        expect($scope.showImage).toBe(true);
    });
});
我的karma.conf文件包含以下内容:

        files: [
        'bower_components/angular/angular.js',
        'bower_components/angular-route/angular-route.js',
        'bower_components/angular-mocks/angular-mocks.js',
        'app.js',
        'services/server-service/server-service.js',
        'components/main/main-controller.js',
        'components/main/main.js',
        'tests/*.js'
    ],
我得到的错误是:

Uncaught Error: [$injector:nomod] Module 'atMain' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
检索现有的角度模块。以这种方式使用时,模块必须已经注册到

angular.module('atMain', [...])
这就是错误消息所说的

angular.module('atMain', [...])