From ddb9dfb2f7ddd2d014223c3d17b8163ebe441662 Mon Sep 17 00:00:00 2001 From: Adam Shaw Date: Fri, 30 May 2014 23:51:16 -0700 Subject: [PATCH] get grunt-karma working with build flow --- Gruntfile.js | 28 ++++++++++++++++++++++++++-- karma.conf.js | 16 +--------------- package.json | 1 + 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index f1d3770..8bca868 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -12,6 +12,7 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-jscs-checker'); + grunt.loadNpmTasks('grunt-karma'); grunt.loadNpmTasks('lumbar'); // Parse config files @@ -42,6 +43,14 @@ module.exports = function(grunt) { 'languages' ]); + // Builds a clean dist directory, for a new release possibly + grunt.registerTask('dist', [ + 'clean', + 'modules', + 'languages', + 'karma:continuous' + ]); + /* FullCalendar Modules @@ -133,6 +142,20 @@ module.exports = function(grunt) { + /* Automated Tests + ----------------------------------------------------------------------------------------------------*/ + + config.karma = { + options: { + configFile: 'karma.conf.js' + }, + url: {}, // you'll have to visit a URL in a browser + headless: { browsers: [ 'PhantomJS' ] }, + continuous: { browsers: [ 'PhantomJS' ], singleRun: true } // "continuous integration" mode + }; + + + /* Archive ----------------------------------------------------------------------------------------------------*/ @@ -140,6 +163,7 @@ module.exports = function(grunt) { 'clean:archive', 'modules', 'languages', + 'karma:continuous', 'copy:archiveModules', 'copy:archiveLanguages', 'copy:archiveLanguagesAll', @@ -259,6 +283,7 @@ module.exports = function(grunt) { 'clean:cdnjs', 'modules', 'languages', + 'karma:continuous', 'copy:cdnjsModules', 'copy:cdnjsLanguages', 'copy:cdnjsLanguagesAll', @@ -296,8 +321,7 @@ module.exports = function(grunt) { ); }); - config.clean.cdnjs = 'dist/cdnjs/<%= meta.version %>'; - // NOTE: not a complete clean. also need to manually worry about package.json and version folders + config.clean.cdnjs = 'dist/cdnjs'; diff --git a/karma.conf.js b/karma.conf.js index 2f764d3..51b03ee 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -56,21 +56,7 @@ module.exports = function(config) { // enable / disable watching file and executing tests whenever any file changes autoWatch: true, - // Start these browsers, currently available: - // - Chrome - // - ChromeCanary - // - Firefox - // - Opera - // - Safari (only Mac) - // - PhantomJS - // - IE (only Windows) - //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: false + captureTimeout: 60000 }); }; \ No newline at end of file diff --git a/package.json b/package.json index a122af9..4007d39 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "grunt-contrib-clean": "~0.4.0", "grunt-contrib-jshint": "~0.8.0", "grunt-jscs-checker": "~0.3.2", + "grunt-karma": "^0.8.3", "lumbar": "~2.0.0-beta19", "karma": "^0.12.1", "karma-jasmine": "^0.2.2",