Parcourir la source

get grunt-karma working with build flow

Adam Shaw il y a 11 ans
Parent
commit
ddb9dfb2f7
3 fichiers modifiés avec 28 ajouts et 17 suppressions
  1. 26 2
      Gruntfile.js
  2. 1 15
      karma.conf.js
  3. 1 0
      package.json

+ 26 - 2
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';
 
 
 

+ 1 - 15
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
 	});
 };

+ 1 - 0
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",