From 4ed3742e444ef501a8d257f1cbd31e930bf4665a Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Thu, 1 Oct 2015 13:33:23 +0900 Subject: [PATCH] Add coverage report --- .gitignore | 3 +++ .travis.yml | 3 +++ karma.conf.js | 10 ++++++++-- package.json | 6 +++++- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 85c9d4f..e6f33ca 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,6 @@ d3.min.js components build .sass-cache + +# coverage report +/coverage diff --git a/.travis.yml b/.travis.yml index 81bf6cf..1b447bd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,3 +7,6 @@ before_script: script: - npm run lint - npm test + +after_success: +- npm run codecov diff --git a/karma.conf.js b/karma.conf.js index d0b54a1..5b737b4 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -31,13 +31,19 @@ module.exports = function(config) { // preprocess matching files before serving them to the browser // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor preprocessors: { + 'c3.js': ['coverage'] }, // test results reporter to use // possible values: 'dots', 'progress' // available reporters: https://npmjs.org/browse/keyword/karma-reporter - reporters: ['spec'], + reporters: ['spec', 'coverage'], + + + coverageReporter: { + reporters: [{type: 'lcov'}] + }, // web server port @@ -50,7 +56,7 @@ module.exports = function(config) { // level of logging // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG - logLevel: config.LOG_DEBUG, + logLevel: config.LOG_INFO, // enable / disable watching file and executing tests whenever any file changes diff --git a/package.json b/package.json index 9301b22..7167840 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "main": "c3.js", "scripts": { "lint": "grunt lint", - "test": "karma start karma.conf.js" + "test": "karma start karma.conf.js", + "codecov": "cat coverage/*/lcov.info | codecov" }, "repository": { "type": "git", @@ -24,6 +25,7 @@ "d3": "<=3.5.0" }, "devDependencies": { + "codecov.io": "^0.1.6", "grunt": "^0.4.5", "grunt-contrib-concat": "~0.5.0", "grunt-contrib-cssmin": "^0.10.0", @@ -33,8 +35,10 @@ "grunt-sass": "^0.17.0", "jasmine-core": "^2.3.4", "karma": "^0.13.10", + "karma-coverage": "^0.5.2", "karma-jasmine": "^0.3.6", "karma-phantomjs-launcher": "^0.2.1", + "karma-spec-reporter": "0.0.20", "load-grunt-tasks": "~0.2.0", "phantomjs": "^1.9.18" }