diff options
author | Johann-S <johann.servoire@gmail.com> | 2018-03-02 16:15:20 +0300 |
---|---|---|
committer | Johann-S <johann.servoire@gmail.com> | 2018-03-05 12:04:54 +0300 |
commit | e43f97304eac2b276c755267e29de70ae2ac7afd (patch) | |
tree | e2fb884e0b4035cdac5329b993913acd0333938e /js | |
parent | b7a549c8c3265109c447ee758e3119a50c9465ca (diff) |
add code coverage
Diffstat (limited to 'js')
-rw-r--r-- | js/tests/karma.conf.js | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/js/tests/karma.conf.js b/js/tests/karma.conf.js index 57d44718da..44c040a24c 100644 --- a/js/tests/karma.conf.js +++ b/js/tests/karma.conf.js @@ -1,5 +1,7 @@ /* eslint-env node */ /* eslint no-process-env: 0 */ +const path = require('path') +const jsCoveragePath = path.resolve(__dirname, '../coverage') module.exports = (config) => { const jqueryFile = process.env.USE_OLD_JQUERY ? 'js/tests/vendor/jquery-1.9.1.min.js' : 'assets/js/vendor/jquery-slim.min.js' @@ -11,18 +13,19 @@ module.exports = (config) => { 'karma-chrome-launcher', 'karma-firefox-launcher', 'karma-qunit', - 'karma-detect-browsers' + 'karma-detect-browsers', + 'karma-coverage-istanbul-reporter' ], // list of files / patterns to load in the browser files: [ jqueryFile, 'assets/js/vendor/popper.min.js', - 'js/dist/util.js', - 'js/dist/tooltip.js', - 'js/dist/!(util|index|tooltip).js', // include all of our js/dist files except util.js, index.js and tooltip.js + 'js/coverage/dist/util.js', + 'js/coverage/dist/tooltip.js', + 'js/coverage/dist/!(util|index|tooltip).js', // include all of our js/dist files except util.js, index.js and tooltip.js 'js/tests/unit/*.js' ], - reporters: ['dots'], + reporters: ['dots', 'coverage-istanbul'], port: 9876, colors: true, // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG @@ -49,6 +52,20 @@ module.exports = (config) => { throw new Error('Please install Firefox or Chrome') } + }, + coverageIstanbulReporter: { + dir: jsCoveragePath, + reports: ['lcov', 'text-summary'], + fixWebpackSourcePaths: true, + thresholds: { + emitWarning: true, + global: { + statements: 80, + lines: 80, + branches: 80, + functions: 80 + } + } } }) } |