From 697dba9d9aac716435b3f1909456119f03773142 Mon Sep 17 00:00:00 2001 From: goodbomb Date: Thu, 18 Jun 2015 21:11:57 -0700 Subject: [PATCH] Added code coverage reporting --- gulpfile.js | 2 +- karma.conf.js | 13 +++++++++---- package.json | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) mode change 100755 => 100644 package.json diff --git a/gulpfile.js b/gulpfile.js index 99b84df..2d70a05 100755 --- a/gulpfile.js +++ b/gulpfile.js @@ -399,7 +399,7 @@ gulp.task('build-dev', function(callback) { // run "gulp test" in terminal to build the DEV app gulp.task('build-test', function(callback) { runSequence( - ['build-dev'], + ['build'], ['karma'], callback ); diff --git a/karma.conf.js b/karma.conf.js index 45a425f..5077698 100755 --- a/karma.conf.js +++ b/karma.conf.js @@ -26,8 +26,8 @@ module.exports = function (config) { // preprocess matching files before serving them to the browser // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor preprocessors: { - // './dist/bundle.js': ['browserify'], - './app/**/*.js': ['browserify'] + './app/**/*.js': ['browserify'], + './app/**/!(*spec)*.js': ['coverage'] }, // karma-browserify configuration @@ -41,9 +41,14 @@ module.exports = function (config) { }, // test results reporter to use - // possible values: 'dots', 'progress' + // possible values: 'dots', 'progress', 'spec' // available reporters: https://npmjs.org/browse/keyword/karma-reporter - reporters: ['spec'], + reporters: ['spec', 'coverage'], + + coverageReporter: { + type: 'html', + dir: './dist/reports/coverage' + }, // web server port port: 9876, diff --git a/package.json b/package.json old mode 100755 new mode 100644 index 38f808a..3e09ed3 --- a/package.json +++ b/package.json @@ -48,6 +48,7 @@ "karma-browserify": "^4.1.2", "karma-chai": "^0.1.0", "karma-chrome-launcher": "^0.1.4", + "karma-coverage": "^0.4.2", "karma-mocha": "^0.1.10", "karma-phantomjs-launcher": "^0.1.4", "karma-sinon": "^1.0.4",