karma test runner错误:需要jquery

时间:2014-08-08 20:37:45

标签: jquery angularjs unit-testing karma-runner test-runner

我很擅长使用业力和单元测试。我试图通过谷歌搜索这个问题找到一个解决方案,但我找不到任何有用的东西,因为我的app / assets / components没有任何jquery fiels,我也没有任何bower_components。如果它有帮助,我在轨道上使用带有角度js的红宝石。

错误:

Chrome 36.0.1985 (Mac OS X 10.9.4) ERROR
Uncaught Error: Bootstrap's JavaScript requires jQuery
at /Users/giowong/rails_project/doctible_pre_treatment/app/assets/javascripts/bootstrap.js:7

Chrome 36.0.1985 (Mac OS X 10.9.4) ERROR
Uncaught Error: Bootstrap's JavaScript requires jQuery
at /Users/giowong/rails_project/doctible_pre_treatment/app/assets/javascripts/bootstrap.min.js:6

Chrome 36.0.1985 (Mac OS X 10.9.4) ERROR
Uncaught ReferenceError: jQuery is not defined
at /Users/giowong/rails_project/doctible_pre_treatment/app/assets/javascripts/ng-grid.js:3591

Chrome 36.0.1985 (Mac OS X 10.9.4) ERROR
Uncaught ReferenceError: jQuery is not defined
at /Users/giowong/rails_project/doctible_pre_treatment/app/assets/javascripts/select2.js:39

我的业力配置文件

 // Karma configuration
module.exports = function(config) {
config.set({
// base path, that will be used to resolve files and exclude
basePath: '/Users/giowong/rails_project/doctible_pre_treatment/',

// testing framework to use (jasmine/mocha/qunit/...)
frameworks: ['jasmine'],

// list of files / patterns to load in the browser
files: [
  'app/assets/components/angular/angular.js',
  'app/assets/components/angular-mocks/angular-mocks.js',
  'app/assets/javascripts/main.js',
  'app/assets/javascripts/**/**/*.js',
  'app/assets/javascripts/*.js',
  'spec/javascripts/*.js'
],

// list of files / patterns to exclude
exclude: ['app/assets/javascripts/angular-google-maps.min.js'



],

// web server port
port: 8080,

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

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

// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers: ['Chrome'],


// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: true
});
};

0 个答案:

没有答案