diff --git a/Gruntfile.js b/Gruntfile.js index 6ff9a040..a374c39b 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -6,7 +6,8 @@ module.exports = function(grunt) { paths: { distFolder: 'dist', - srcFolder: 'src' + srcFolder: 'src', + testFolder: 'src/__tests__', }, clean: ['<%= paths.distFolder %>'], @@ -32,14 +33,31 @@ module.exports = function(grunt) { '<%= paths.distFolder %>/css-layout.min.js': ['<%= paths.srcFolder %>/Layout.js'] } } + }, + + karma: { + main: { + options: { + files: [ + '<%= paths.srcFolder %>/Layout.js', + '<%= paths.srcFolder %>/Layout-test-utils.js', + '<%= paths.testFolder %>/Layout-test.js', + '<%= paths.testFolder %>/Layout-consts-test.js' + ], + browsers: ['Chrome'], + frameworks: ['jasmine'], + singleRun: true + } + } } }); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-karma'); - grunt.registerTask('build', ['clean', 'copy', 'uglify']); + grunt.registerTask('build', ['clean', 'karma' ,'copy', 'uglify']); grunt.registerTask('default', ['build']); diff --git a/karma.conf.js b/karma.conf.js deleted file mode 100644 index 61ca91f9..00000000 --- a/karma.conf.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict'; - -module.exports = function (config) { - config.set({ - - // base path, that will be used to resolve files and exclude - basePath: 'src', - - // frameworks to use - frameworks: ['jasmine'], - - // list of files / patterns to load in the browser - files: [ - 'Layout.js', - 'Layout-test-utils.js', - '__tests__/Layout-test.js', - '__tests__/Layout-consts-test.js' - ], - - plugins: [ - 'karma-chrome-launcher', - 'karma-jasmine' - ], - - // web server port - port: 9876, - - // enable / disable colors in the output (reporters and logs) - colors: true, - - // level of logging - // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG - logLevel: config.LOG_INFO, - - browsers: ['Chrome'], - - // If browser does not capture in given timeout [ms], kill it - captureTimeout: 60000, - - singleRun: false - }); -}; diff --git a/package.json b/package.json index 64cd4ae6..6fc31ec1 100644 --- a/package.json +++ b/package.json @@ -24,8 +24,9 @@ "grunt-contrib-clean": "^0.6.0", "grunt-contrib-copy": "^0.8.0", "grunt-contrib-uglify": "^0.9.1", + "grunt-karma": "^0.12.0", "jasmine-core": "^2.2.0", - "karma": "^0.12.31", + "karma": "^0.13.8", "karma-chrome-launcher": "^0.1.7", "karma-jasmine": "^0.3.5" }