From 6b4c7e44e3984e6d076f1e0cd3e99f30e978e8e2 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Sun, 13 Dec 2015 12:37:58 +0200 Subject: [PATCH] Setup coverage and coveralls --- .gitignore | 1 + .travis.yml | 1 + karma.conf.js | 32 +++++++++++++++++++++++++++++++- package.json | 6 +++++- 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 1e8b30c1..38afc934 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ jspm_packages /dist /demo/build .tmp +/coverage diff --git a/.travis.yml b/.travis.yml index f1f740e9..6dc541b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ env: - GH_REF: github.com/Rebilly/ReDoc.git - secure: ijk9zRQxw1XKVt1zjuJ4uc3iyU622HB0qSPdwVECqhUMm3Gh3MAmTH1bqubsSHKZbfNNIehUvu+X/3LeKZNUK+zBS8qbLXWQKZ4ime4RHT8ADjZV+NY2GdQUxs5rklb3kjVK6cOQ8A51jU/8Zw738iFDDPz3NxbXC+MP3CQANxYCeX2axdxVFzQcldA89vZr0K8DBMPW1EZP+e1jORB3YFwyKZMppB9XvI7GAjt2OQvZDQegNuVaPuECZcJjPh2VBopQ3+Giun2AIe3C0Q/DmU+rZd8M2/t2VEv0e6BZNtbpycq8ST3mWloTPhmL9F2xlm4ZuWUVWuxB3LgOTZUw11KRg51MUTv/9Xfrqf16CUvR4TJ7EDYAKt5NwVFNUJsIy9cpuI6fsndFeI7EWFFYN7m4FX/SWLhVzFcrZeWpwbMn+qFCE0S+VgUjwYwMMA667YgRPhIAGoJfL5MxrhE/HPUIDJU91t9ON7UpFcdcUex6jX9pKUvyP52uJQKIwP10ZgehvL3S0iutMYVYY0YNkKF4tIPiQPsCK4lx7Up4D/tR9jSZl11CLMBZ0jLk1sEtgMf9+v0emOiGIgmBBYwVec6Jy1kSJyEeAJThmLjdVtAVgT0T3jPhM0Z8BE0xkwFY/5myQeoo8QWd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xMbKE6aTe4Otfo36qsLtokKM2ABgl1AEgp/QKPusnjuQi4RThfCYU5tmTtqij/a4Lj5NUAyOcMSgj5hZncRWynApvIAgfBeruYpWF++F2SMyox7+p5jJOThLczLxMn4pikh9O6rvTMVVXIhapnIaH4v9HWssousBSAnmU2+Y9Eltzikh5iFmPUcgXiq4ULmxMagYDllNO15lGMgbc6lJAJfwZ4293vEpJHdHy8jIKYe5eZwSBe0axUB/3oshnQlPptcSVCTuJM0anWOlsZz2mvfXFDZ628bNf/PGoTYtw9TGtMu/RoGAKQrFTyzx/9OmQQyBwDD5jQGKt//gf48g/fXdCyAQ= cache: directories: - node_modules diff --git a/karma.conf.js b/karma.conf.js index b3fc5cd1..9fbba618 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,7 +1,37 @@ module.exports = function (config) { + var travis = process.env.TRAVIS; config.set({ frameworks: ['phantomjs-shim', 'jspm', 'mocha', 'chai', 'sinon'], + preprocessors: { + 'lib/**/!(*spec).js': ['babel', 'coverage'] + }, + babelPreprocessor: { + options: { + sourceMap: 'inline', + "optional": [ + "runtime", + "optimisation.modules.system", + "es7.decorators", + "es7.classProperties" + ] + }, + sourceFileName: function(file) { + return file.originalPath; + } + }, + coverageReporter: { + instrumenters: { isparta : require('isparta') }, + instrumenter: { + 'lib/**/!(*spec).js': 'isparta' + }, + dir: 'coverage/', + reporters: [ + {type: 'html'}, + {type: 'text-summary'}, + {type: 'lcov'} + ] + }, client: { chai: { truncateThreshold: 0 @@ -27,7 +57,7 @@ module.exports = function (config) { '/jspm_packages/': '/base/jspm_packages/', '/node_modules/': '/base/node_modules/', }, - reporters: ['mocha'], + reporters: travis ? ['mocha', 'coverage', 'coveralls'] : ['mocha', 'coverage'], browsers: ['PhantomJS'], diff --git a/package.json b/package.json index 40bc4da0..4bb9dcce 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ } }, "devDependencies": { - "babel": "^6.3.13", + "babel": "^5.8.34", "babel-eslint": "^4.1.3", "babel-polyfill": "^6.3.14", "browser-sync": "^2.9.8", @@ -64,11 +64,15 @@ "gulp-replace": "^0.5.4", "gulp-sass": "^2.1.0", "gulp-sourcemaps": "^1.6.0", + "isparta": "^4.0.0", + "istanbul": "github:gotwarlost/istanbul#source-map", "jshint-stylish": "^2.0.1", "jspm": "^0.16.11", "karma": "^0.13.15", + "karma-babel-preprocessor": "^5.2.2", "karma-chai": "github:randing89/karma-chai", "karma-chrome-launcher": "^0.2.2", + "karma-coverage": "github:douglasduteil/karma-coverage#next", "karma-jspm": "^2.0.2", "karma-mocha": "^0.2.1", "karma-mocha-reporter": "^1.1.3",