Error running karma test: jquery required

I am new to using karma and unit testing in general. I tried to find a solution by doing this problem, but I couldn't find anything useful since my app / assets / components don't have any jquery files, whatever, and I don't have bower_components. If it helps, I am using ruby ​​on rails with angular js together.

errors:

Chrome 36.0.1985 (Mac OS X 10.9.4) ERROR
Uncaught Error: Bootstrap 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 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

      

my karma config file

 // 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
});
};

      

+3


source to share





All Articles