From 9c1a0cbc16b597276443137f932d87d4de0bfe86 Mon Sep 17 00:00:00 2001 From: Evert Timberg Date: Fri, 28 Aug 2015 18:52:46 -0400 Subject: [PATCH 1/2] This should run the unit tests from the CI system --- gulpfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index 560c6b496..46c1f2b88 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -133,7 +133,7 @@ gulp.task('watch', function() { gulp.watch('./src/**', ['build', 'unittest']); }); -gulp.task('test', ['jshint', 'valid']); +gulp.task('test', ['jshint', 'valid', 'unittest']); gulp.task('size', ['library-size', 'module-sizes']); From 92f1c65c1c2651c23f415d70b10e5210b2fca78c Mon Sep 17 00:00:00 2001 From: Evert Timberg Date: Fri, 28 Aug 2015 19:02:37 -0400 Subject: [PATCH 2/2] Install coverage metrics. Use `gulp coverage` to generate coverage reports --- .gitignore | 2 ++ gulpfile.js | 11 +++++++++++ karma.coverage.conf.js | 18 ++++++++++++++++++ package.json | 1 + test/core.helpers.tests.js | 0 5 files changed, 32 insertions(+) create mode 100644 karma.coverage.conf.js create mode 100644 test/core.helpers.tests.js diff --git a/.gitignore b/.gitignore index 5016e5def..5b80f24cb 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ custom/* docs/index.md bower_components/ + +coverage/* diff --git a/gulpfile.js b/gulpfile.js index 46c1f2b88..0a5b3d3b9 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -111,6 +111,17 @@ gulp.task('unittest', function() { })); }); +gulp.task('coverage', function() { + var files = srcFiles.slice(); + files.push(testDir + '*.js'); + + return gulp.src(files) + .pipe(karma({ + configFile: 'karma.coverage.conf.js', + action: 'run' + })); +}); + gulp.task('library-size', function() { return gulp.src('Chart.min.js') .pipe(size({ diff --git a/karma.coverage.conf.js b/karma.coverage.conf.js new file mode 100644 index 000000000..cc047aa4d --- /dev/null +++ b/karma.coverage.conf.js @@ -0,0 +1,18 @@ +module.exports = function(config) { + config.set({ + browsers: ['Chrome', 'Firefox'], + + coverageReporter: { + type: 'html', + dir: 'coverage/' + }, + + frameworks: ['jasmine'], + + preprocessors: { + 'src/**/*.js': ['coverage'] + }, + + reporters: ['progress', 'coverage'], + }); +}; \ No newline at end of file diff --git a/package.json b/package.json index 27ed2888b..066d65369 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "jquery": "^2.1.4", "karma": "^0.12.37", "karma-chrome-launcher": "^0.2.0", + "karma-coverage": "^0.5.1", "karma-firefox-launcher": "^0.1.6", "karma-jasmine": "^0.3.6", "onecolor": "^2.5.0", diff --git a/test/core.helpers.tests.js b/test/core.helpers.tests.js new file mode 100644 index 000000000..e69de29bb