Instantly share code, notes, and snippets.

Embed
What would you like to do?
Karma configuration File to run with gulp-karma - This setup is for an AMD project with Angular and RequireJS. The essential part to get Karma working, was to load Angular and requireJS test.config.js files before the project files. Plugins: karma-requireJS, karma-spec-reporter, karma-jasmine, karma-phantomjs-launcher
(function ( module ) {
'use strict';
module.exports = function( config ) {
config.set({
basePath : '../',
urlRoot: '/base/',
proxies: {
'/': 'http://flyweb.dev:9876/'
},
// list of files / patterns to load in the browser
files : [
// load angular before the patterns you fool(!)
'bower_components/angular/angular.js',
'test/unit-test.conf.js',
{ pattern: 'bower_components/**/*.js', watched: false, included: false },
{ pattern: 'app/scripts/**/*.js', watched: true, included: false },
{ pattern: 'app/vendor/**/*.js', watched: true, included: false }
],
// exclude app's requireJS config
exclude : [
'app/scripts/config.js'
],
autoWatch : true,
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun : false,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel : config.LOG_ERROR,
// test results reporter to use
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage', 'spec'
reporters: ['spec'],
specReporter : {
// suppressPassed: true,
// suppressFailed: true,
// suppressSkipped: true,
maxLogLines: 1 // karma-spec-reporter - https://github.com/mlex/karma-spec-reporter/issues/19
},
colors: true,
browsers : [
// 'Chrome',
'PhantomJS'
],
plugins : [
'karma-phantomjs-launcher',
'karma-jasmine',
'karma-requirejs',
'karma-spec-reporter'
],
frameworks : [
'jasmine',
'requirejs'
]
});
};
}( module ));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment