3

我一般不熟悉使用业力和单元测试。我尝试通过谷歌搜索这个问题来找到解决方案,但我找不到任何有用的东西,因为我的应用程序/资产/组件没有任何 jquery 字段,我也没有任何 bower_components。如果有帮助,我正在使用 ruby​​ on rails 和 angular 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
});
};
4

0 回答 0