Permalink
Browse files

add code coverage

  • Loading branch information...
Johann-S committed Mar 2, 2018
1 parent b7a549c commit e43f97304eac2b276c755267e29de70ae2ac7afd
Showing with 774 additions and 354 deletions.
  1. +6 −1 .babelrc.js
  2. +1 −0 .gitignore
  3. +22 −5 js/tests/karma.conf.js
  4. +741 −347 package-lock.json
  5. +4 −1 package.json
@@ -12,5 +12,10 @@ module.exports = {
plugins: [
process.env.PLUGINS && 'transform-es2015-modules-strip',
'@babel/proposal-object-rest-spread'
].filter(Boolean)
].filter(Boolean),
env: {
test: {
plugins: [ 'istanbul' ]
}
}
};
@@ -44,3 +44,4 @@ twbsconfig.yml
# Folders to ignore
node_modules
js/coverage
@@ -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
}
}
}
})
}
Oops, something went wrong.

0 comments on commit e43f973

Please sign in to comment.