0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-01 13:24:25 +01:00
Bootstrap/js/tests/karma.conf.js

77 lines
2.1 KiB
JavaScript
Raw Normal View History

/* eslint-env node */
/* eslint no-process-env: 0 */
2018-03-02 14:15:20 +01:00
const path = require('path')
const jsCoveragePath = path.resolve(__dirname, '../coverage')
module.exports = (config) => {
2018-03-21 11:00:13 +01:00
const jqueryFile = process.env.USE_OLD_JQUERY ? 'https://code.jquery.com/jquery-1.9.1.min.js' : 'assets/js/vendor/jquery-slim.min.js'
config.set({
basePath: '../..',
2018-03-09 23:17:57 +01:00
frameworks: ['qunit', 'sinon', 'detectBrowsers'],
plugins: [
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-qunit',
2018-03-09 23:17:57 +01:00
'karma-sinon',
2018-03-02 14:15:20 +01:00
'karma-detect-browsers',
'karma-coverage-istanbul-reporter'
],
// list of files / patterns to load in the browser
files: [
jqueryFile,
'assets/js/vendor/popper.min.js',
2018-03-02 14:15:20 +01:00
'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'
],
2018-03-02 14:15:20 +01:00
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
logLevel: config.LOG_ERROR || config.LOG_WARN,
autoWatch: false,
customLaunchers: {
FirefoxHeadless: {
base: 'Firefox',
flags: ['-headless']
}
},
singleRun: true,
concurrency: Infinity,
detectBrowsers: {
usePhantomJS: false,
postDetection(availableBrowser) {
if (typeof process.env.TRAVIS_JOB_ID !== 'undefined' || availableBrowser.includes('Chrome')) {
return ['ChromeHeadless']
}
if (availableBrowser.includes('Firefox')) {
return ['FirefoxHeadless']
}
throw new Error('Please install Firefox or Chrome')
}
2018-03-02 14:15:20 +01:00
},
coverageIstanbulReporter: {
dir: jsCoveragePath,
reports: ['lcov', 'text-summary'],
thresholds: {
emitWarning: false,
2018-03-02 14:15:20 +01:00
global: {
statements: 90,
branches: 84,
functions: 87,
lines: 90
2018-03-02 14:15:20 +01:00
}
}
},
client: {
qunit: {
showUI: true
}
}
})
}