From 60fcad33ca0584ca2ffff160881776e911578f59 Mon Sep 17 00:00:00 2001 From: jlukic Date: Sun, 13 Oct 2013 16:09:54 -0400 Subject: [PATCH] Moves test runner into grunt task for travis --- .travis.yml | 4 +++- node/Gruntfile.js | 37 +++++++++++++++++++++++++++++++------ node/package.json | 12 +++++++++++- package.json | 2 +- 4 files changed, 46 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index a575c519c..c550614e8 100755 --- a/.travis.yml +++ b/.travis.yml @@ -3,4 +3,6 @@ node_js: - "0.10" before_script: - export DISPLAY=:99.0 - - sh -e /etc/init.d/xvfb start \ No newline at end of file + - sh -e /etc/init.d/xvfb start + - npm install -g grunt-cli + - grunt test \ No newline at end of file diff --git a/node/Gruntfile.js b/node/Gruntfile.js index 5e3da8ece..28e9e1760 100755 --- a/node/Gruntfile.js +++ b/node/Gruntfile.js @@ -3,7 +3,7 @@ module.exports = function(grunt) { var defaultTasks = [ - // watch less folder + // run grunt watch 'watch' ], @@ -15,7 +15,13 @@ module.exports = function(grunt) { 'copy:srcToDocs', // copies examples over to docs - 'copy:examplesToDocs' + 'copy:examplesToDocs', + + ], + + testTasks = [ + // test components + 'karma:test:run' ], buildTasks = [ @@ -109,10 +115,16 @@ module.exports = function(grunt) { // watches for changes in a source folder watch: { + options: { + spawn: false + }, scripts: { - options: { - spawn: false - }, + files: [ + '../src/**/*.js' + ], + tasks : testTasks + }, + src: { files: [ '../build/examples/**/*', '../src/**/*.less', @@ -122,6 +134,18 @@ module.exports = function(grunt) { } }, + /******************************* + Test + *******************************/ + + karma: { + test: { + configFile : '../test/karma.conf.js', + background : true, + reporters: 'dots' + } + }, + /******************************* Build *******************************/ @@ -488,12 +512,13 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-docco-multi'); grunt.loadNpmTasks('grunt-cssjanus'); + grunt.loadNpmTasks('grunt-karma'); grunt.initConfig(config); grunt.registerTask('default', defaultTasks); - grunt.registerTask('build', buildTasks); + grunt.registerTask('test', testTasks); // compiles only changed less files grunt.event.on('watch', setWatchFiles); diff --git a/node/package.json b/node/package.json index 781937f9e..72b8c2f8b 100755 --- a/node/package.json +++ b/node/package.json @@ -23,6 +23,16 @@ "grunt-contrib-compress": "~0.5.2", "grunt-contrib-concat": "~0.3.0", "grunt-docco-multi": "0.0.2", - "grunt-cssjanus": "~0.1.1" + "grunt-cssjanus": "~0.1.1", + "karma-script-launcher": "~0.1.0", + "karma-chrome-launcher": "~0.1.0", + "karma-firefox-launcher": "~0.1.0", + "karma-html2js-preprocessor": "~0.1.0", + "karma-jasmine": "~0.1.3", + "karma-requirejs": "~0.1.0", + "karma-coffee-preprocessor": "~0.1.0", + "karma-phantomjs-launcher": "~0.1.0", + "karma": "~0.10.2", + "grunt-karma": "~0.6.2" } } diff --git a/package.json b/package.json index e6d5213bb..4bbf40c09 100755 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "karma": "~0.8" }, "scripts": { - "test": "./node_modules/.bin/karma start --browsers Firefox --single-run" + "test": "grunt travis --verbose" }, "license": "MIT" }