Sets up gulp task for test

This commit is contained in:
2016-02-11 14:25:08 +01:00
parent f291e0f215
commit 15974168f5
3 changed files with 53 additions and 0 deletions

20
gulpfile.js Normal file
View File

@@ -0,0 +1,20 @@
var gulp = require('gulp');
var plugins = require('gulp-load-plugins')({});
gulp.task('test', function() {
console.log(plugins);
return gulp.src('test/karma.conf.js')
.pipe(plugins.karma({
configFile: 'test/karma.conf.js',
action: 'run'
}))
.on('error', function(err) {
console.log(err);
this.emit('end');
});
});
gulp.task('autotest', function() {
return gulp.watch(['static/js/**/*.js','test/specs/*.js'], ['test']);
});

View File

@@ -6,7 +6,9 @@
"bower": "^1.7.7",
"gulp": "^3.9.1",
"gulp-jasmine": "^2.2.1",
"gulp-karma": "0.0.5",
"gulp-load-plugins": "^1.2.0",
"gulp-util": "^3.0.7",
"jasmine-core": "^2.4.1",
"karma": "^0.13.19",
"karma-chrome-launcher": "^0.2.2",
@@ -17,6 +19,7 @@
},
"scripts": {
"postinstall": "bower install",
"test": "gulp test"
},
"repository": {
"type": "git",

30
test/karma.conf.js Normal file
View File

@@ -0,0 +1,30 @@
module.exports = function(config) {
config.set({
basepath: './',
files : [
'static/bower_components/angular/angular.js',
'static/bower_components/angular-route/angular-route.js',
'static/bower_components/angular-mocks/angular-mocks.js',
'static/js/**/*.js',
'test/specs/**/*.js'
],
autoWatch: true,
frameworks: ['jasmine'],
browser: ['Chrome'],
plugins : [
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-jasmine',
'karma-junit-reporter'
],
junitReporter : {
outputFile: 'test_out/unit.xml',
suite: 'unit'
}
});
};