AngularJS:在业力testingmodule.exports:模块没有定义

我试图写一个外部模块来处理我的服务使用module.exports我的业力testing,但我不断收到

未捕获的ReferenceError:模块未定义

这是我的karma.conf.js文件:

 // Karma configuration // Generated on Fri Nov 07 2014 11:32:23 GMT-0600 (CST) 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/angular-mocks/angular-mocks.js', 'tests/unit/*.js', 'tests/unit/*.spec.js', 'tests/unit/**/*.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: ['Chrome'], // Continuous Integration mode // if true, Karma captures browsers, runs the tests and exits singleRun: false }); }; 

而我的模块看起来像这样:

 var devSrv = (function(){ return{ get: 'abc' } }()); module.exports = devSrv; 

作为一个侧面说明,我也有使用量angular器这个问题。