AngularJS:karma测试中的module.exports:模块未定义

时间:2014-11-10 15:54:46

标签: angularjs node.js jasmine protractor karma-runner

我正在尝试使用module.exports编写一个外部模块来处理我的业力测试,但我一直在

  

未捕获的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;

作为旁注,我也有使用量角器的问题。

0 个答案:

没有答案
相关问题