0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-11-28 10:24:19 +01:00
Bootstrap/js/tests/karma.conf.js
Mark Otto 0e920ce3f4 Reorganize docs for easier deploys
With the current docs directory setup, I'm making too many mistakes and have to manually address path changes and directory moves on deploy. This makes for a frustrating experience developing locally and shipping releases. With this PR, we're basically back to the same setup from v3—duplicating the dist directory into our docs directory. Not the most ideal, but very straightforward for me as the release manager.
2018-07-11 23:30:46 -07:00

77 lines
2.1 KiB
JavaScript

/* 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 ? 'https://code.jquery.com/jquery-1.9.1.min.js' : 'site/docs/4.1/assets/js/vendor/jquery-slim.min.js'
config.set({
basePath: '../..',
frameworks: ['qunit', 'sinon', 'detectBrowsers'],
plugins: [
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-qunit',
'karma-sinon',
'karma-detect-browsers',
'karma-coverage-istanbul-reporter'
],
// list of files / patterns to load in the browser
files: [
jqueryFile,
'site/docs/4.1/assets/js/vendor/popper.min.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', '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')
}
},
coverageIstanbulReporter: {
dir: jsCoveragePath,
reports: ['lcov', 'text-summary'],
thresholds: {
emitWarning: false,
global: {
statements: 90,
branches: 84,
functions: 87,
lines: 90
}
}
},
client: {
qunit: {
showUI: true
}
}
})
}