当我在spec文件中使用$ inject时,我收到以下错误 .

我在karma.conf.js中添加了bower.json的所有依赖项 .

请帮我在spec.js文件中使用$ inject

app.js:

(function () {
    'use strict';

    angular
        .module('modulename', [
            'app.vegetation'
        ]);
})();

spec.js:

describe("Basic Test", function () {
    beforeEach(module('modulename'));
    beforeEach(module('app.vegetation'));

    beforeEach(angular.mock.inject(function (_$controller_) {
        //scope = $rootscope.$new();
        //mainctrl = $controller('ProjectDetailsController', { $scope: scope });
        //$scope.password = 'longerthaneightchars';
        //$scope.grade();
    }));

    it("contains spec with an expectation", function () {
        expect(true).toBe(true);
    });
});

Karma.conf.js

module.exports = function(config) {
    config.set({
        // base path that will be used to resolve all patterns (eg. files, exclude)
        basePath: '',

        // frameworks to use
        // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
        frameworks: ['jasmine'],

        // list of files / patterns to load in the browser
        files: [
            'bower_components/jquery/dist/jquery.js',
            'bower_components/angular/angular.js',
            'bower_components/angular-loading-bar/build/loading-bar.js',
            'bower_components/angular-ui-router/release/angular-ui-router.js',
            'bower_components/angular-route/angular-route.js',
            'bower_components/angular-bootstrap/ui-bootstrap.js',
            'bower_components/angular-bootstrap/ui-bootstrap.min.js',
            'bower_components/angular-cookies/angular-cookies.js',
            'bower_components/angular-animate/angular-animate.js',
            'bower_components/angular-ui-utils/index.js',
            'bower_components/oclazyload/dist/ocLazyLoad.js',
            'bower_components/slimScroll/jquery.slimscroll.min.js',
            'bower_components/ngstorage/ngStorage.js',
            'bower_components/modernizr/modernizr.custom.js',
            'bower_components/angular-sanitize/angular-sanitize.js',
            'bower_components/angular-resource/angular-resource.js',
            'bower_components/angular-touch/angular-touch.js',
            'bower_components/jquery.browser/dist/jquery.browser.js',
            //'bower_components/angular-ui-map/ui.map.js',
            'bower_components/angular-material/angular-material.js',
            'bower_components/angular-aria/angular-aria.js',
            'bower_components/angular-messages/angular-messages.js',
            'bower_components/angular-mocks/angular-mocks.js',
            'app/**/*.module.js',
            'app/js/app.js',
            'app/js/*.js',
            'app/js/vegetation/projectdetails/projectdetails.controller.js',
            'test/*.spec.js'
        ],


        // list of files to exclude
        exclude: [
        ],

        // preprocess matching files before serving them to the browser
        // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
        preprocessors: {
        },

        // test results reporter to use
        // possible values: 'dots', 'progress'
        // available reporters: https://npmjs.org/browse/keyword/karma-reporter
        reporters: ['progress'],

        // web server port
        port: 9876,

        // enable / disable colors in the output (reporters and logs)
        colors: true,

        // level of logging
        // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
        logLevel: config.LOG_INFO,

        // enable / disable watching file and executing tests whenever any file changes
        autoWatch: true,

        // start these browsers
        // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
        browsers: ['PhantomJS'],

        // Continuous Integration mode
        // if true, Karma captures browsers, runs the tests and exits
        singleRun: true,

        // Concurrency level
        // how many browser should be started simultaneous
        concurrency: Infinity
    })
}

Bower.json:

"dependencies": {
    "angular-loading-bar": "0.8.0",
    "angular-ui-router": "0.2.18",
    "angular": "1.5.0",
    "angular-route": "1.5.0",
    "angular-bootstrap": "1.1.2",
    "angular-cookies": "1.5.0",
    "angular-animate": "1.5.0",
    "angular-ui-utils": "3.0.0",
    "fontawesome": "4.5.0",
    "oclazyload": "1.0.9",
    "slimScroll": "1.3.7",
    "ngstorage": "0.3.10",
    "jquery": "2.2.1",
    "modernizr": "https://modernizr.com/download?backgroundsize-bgpositionshorthand-bgpositionxy-bgrepeatspace_bgrepeatround-bgsizecover-borderradius-cssanimations-csscalc-csstransforms-csstransforms3d-csstransitions-flexboxtweener-fontface-inlinesvg-localstorage-multiplebgs-preserve3d-sessionstorage-smil-svgclippaths-svgfilters-svgforeignobject-todataurljpeg_todataurlpng_todataurlwebp-setclasses&q=background.zip",
    "angular-sanitize": "1.5.0",
    "angular-resource": "1.5.0",
    "simple-line-icons": "2.2.3",
    "angular-touch": "1.5.0",
    "jquery.browser": "master",
    "angular-ui-map": "0.5.0",
    "weather-icons": "2.0.10",
    "angular-material": "1.0.5",
    "angular-aria": "1.5.0",
    "angular-messages": "1.5.0",
    "angular-file-upload": "2.2.0",
    "angular-mocks": "1.5.0"
  },
  "resolutions": {
    "angular": "1.5.0",
    "angular-ui-utils": "3.0.0"
  }

错误

PhantomJS 2.1.1 (Windows 7 0.0.0) Basic Test contains spec with an expectation F
AILED
        bower_components/angular/angular.js:4527:53
        forEach@bower_components/angular/angular.js:321:24
        loadModules@bower_components/angular/angular.js:4487:12
        createInjector@bower_components/angular/angular.js:4409:30
        workFn@bower_components/angular-mocks/angular-mocks.js:2954:60
        loaded@http://localhost:9876/context.js:162:17
PhantomJS 2.1.1 (Windows 7 0.0.0): Executed 1 of 1 (1 FAILED) (0 secs / 0.034 se
PhantomJS 2.1.1 (Windows 7 0.0.0): Executed 1 of 1 (1 FAILED) ERROR (0.009 secs
/ 0.034 secs)