Merge branch 'karma-fix' of github.com:drkibitz/pixi.js into drkibitz-karma-fix

This commit is contained in:
Chad Engler 2014-01-12 10:07:58 -08:00
commit 1ed43e1dfd
4 changed files with 36 additions and 31 deletions

View file

@ -103,7 +103,8 @@ module.exports = function(grunt) {
}, },
files: { files: {
srcBlob: '<%= dirs.src %>/**/*.js', srcBlob: '<%= dirs.src %>/**/*.js',
testBlob: '<%= dirs.test %>/{functional,lib/pixi,unit/pixi}/**/*.js', testBlob: '<%= dirs.test %>/**/*.js',
testConf: '<%= dirs.test %>/karma.conf.js',
build: '<%= dirs.build %>/pixi.dev.js', build: '<%= dirs.build %>/pixi.dev.js',
buildMin: '<%= dirs.build %>/pixi.js' buildMin: '<%= dirs.build %>/pixi.js'
}, },
@ -131,10 +132,16 @@ module.exports = function(grunt) {
options: { options: {
jshintrc: './.jshintrc' jshintrc: './.jshintrc'
}, },
source: srcFiles.filter(function(v) { return v.match(/(Intro|Outro|Spine|Pixi)\.js$/) === null; }).concat('Gruntfile.js'), source: {
src: srcFiles.concat('Gruntfile.js'),
options: {
ignores: '<%= dirs.src %>/**/{Intro,Outro,Spine,Pixi}.js'
}
},
test: { test: {
src: ['<%= files.testBlob %>'], src: ['<%= files.testBlob %>'],
options: { options: {
ignores: '<%= dirs.test %>/lib/resemble.js',
jshintrc: undefined, //don't use jshintrc for tests jshintrc: undefined, //don't use jshintrc for tests
expr: true, expr: true,
undef: false, undef: false,
@ -184,7 +191,7 @@ module.exports = function(grunt) {
}, },
karma: { karma: {
unit: { unit: {
configFile: 'test/karma.conf.js', configFile: '<%= files.testConf %>',
// browsers: ['Chrome'], // browsers: ['Chrome'],
singleRun: true singleRun: true
} }

View file

@ -37,7 +37,9 @@
"mocha": "~1.15", "mocha": "~1.15",
"chai": "~1.8", "chai": "~1.8",
"karma": "~0.10", "karma": "~0.10",
"karma-chrome-launcher": "~0.1",
"karma-firefox-launcher": "~0.1", "karma-firefox-launcher": "~0.1",
"karma-mocha": "~0.1" "karma-mocha": "~0.1",
"karma-spec-reporter": "~0.0.6"
} }
} }

View file

@ -1,27 +1,22 @@
'use strict';
var path = require('path');
var server = require('karma').server;
module.exports = function (grunt) { module.exports = function (grunt) {
grunt.registerMultiTask('karma', 'run karma.', function() { 'use strict';
var done = this.async();
var options = this.options({
background: false
});
var data = this.data;
//merge options onto data, with data taking precedence var path = require('path');
data = grunt.util._.merge(options, data); var server = require('karma').server;
data.configFile = path.resolve(data.configFile);
if (data.configFile) { grunt.registerMultiTask('karma', 'run karma.', function(target) {
data.configFile = grunt.template.process(data.configFile); //merge data onto options, with data taking precedence
var options = grunt.util._.merge(this.options(), this.data),
done = this.async();
if (options.configFile) {
options.configFile = grunt.template.process(options.configFile);
options.configFile = path.resolve(options.configFile);
} }
server.start( done = this.async();
data, server.start(options, function(code) {
function(code) { done(!code);
done(!code); });
});
}); });
}; };

View file

@ -17,12 +17,12 @@ module.exports = function(config) {
], ],
// list of files to exclude // list of files to exclude
exclude : [], //exclude : [],
// use dolts reporter, as travis terminal does not support escaping sequences // use dolts reporter, as travis terminal does not support escaping sequences
// possible values: 'dots', 'progress', 'junit', 'teamcity' // possible values: 'dots', 'progress', 'junit', 'teamcity'
// CLI --reporters progress // CLI --reporters progress
reporters : ['progress'], reporters : ['spec'],
// web server port // web server port
// CLI --port 9876 // CLI --port 9876
@ -39,7 +39,7 @@ module.exports = function(config) {
// level of logging // level of logging
// possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG
// CLI --log-level debug // CLI --log-level debug
logLevel : config.LOG_DEBUG, logLevel : config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes // enable / disable watching file and executing tests whenever any file changes
// CLI --auto-watch --no-auto-watch // CLI --auto-watch --no-auto-watch
@ -69,14 +69,15 @@ module.exports = function(config) {
reportSlowerThan : 500, reportSlowerThan : 500,
preprocessors : { preprocessors : {
// '**/client/js/*.js': 'coverage' // '**/client/js/*.js': 'coverage'
}, },
plugins : [ plugins : [
'karma-mocha', 'karma-chrome-launcher',
// 'karma-chrome-launcher',
'karma-firefox-launcher', 'karma-firefox-launcher',
'karma-mocha',
// 'karma-phantomjs-launcher' // 'karma-phantomjs-launcher'
'karma-spec-reporter'
] ]
}); });
}; };