Created
November 23, 2016 05:56
-
-
Save jerryjohnjacob/49edc308281c963272ef3dfbb2df4b5d to your computer and use it in GitHub Desktop.
Basic Karma config for testing JS in a Rails project using Jasmine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Karma configuration | |
module.exports = function(config) { | |
config.set({ | |
// base path, that will be used to resolve files and exclude | |
basePath: '', | |
// frameworks to use | |
frameworks: ['jasmine-jquery', 'jasmine'], | |
// list of files to exclude | |
exclude: [ | |
], | |
// list of files / patterns to load in the browser | |
files: [ | |
// { | |
// pattern: 'spec/javascripts/fixtures/**/*.html', | |
// watched: true, | |
// included: false, | |
// served: true | |
// }, | |
'http://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.2/jquery.min.js', | |
'http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.7.0/moment.min.js', | |
'https://cdnjs.cloudflare.com/ajax/libs/jquery-ujs/1.1.0/rails.min.js', | |
// add more external libs here | |
'lib/assets/javascripts/**/*.js', | |
// add any other specific JS required files here | |
'app/assets/javascripts/*.js', | |
// add any other spec support files here | |
'http://cdnjs.cloudflare.com/ajax/libs/sinon.js/1.7.3/sinon-min.js', | |
'spec/javascripts/support/*.js', | |
'spec/javascripts/**/*.spec.js', | |
{ | |
pattern: 'spec/javascripts/fixtures/*', | |
included: false, | |
served: true | |
} | |
], | |
// test results reporter to use | |
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' | |
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: false, | |
// Start these browsers, currently available: | |
// - Chrome | |
// - ChromeCanary | |
// - Firefox | |
// - Opera (has to be installed with `npm install karma-opera-launcher`) | |
// - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`) | |
// - PhantomJS | |
// - IE (only Windows; has to be installed with `npm install karma-ie-launcher`) | |
browsers: ['PhantomJS'], | |
// If browser does not capture in given timeout [ms], kill it | |
captureTimeout: 60000, | |
// Continuous Integration mode | |
// if true, it capture browsers, run tests and exit | |
singleRun: true | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment