5
const path = require('path')
6
const ip = require('ip')
7
const { browsers, browsersKeys } = require('./browsers')
9
const USE_OLD_JQUERY = Boolean(process.env.USE_OLD_JQUERY)
10
const BUNDLE = Boolean(process.env.BUNDLE)
11
const BROWSERSTACK = Boolean(process.env.BROWSERSTACK)
12
const JQUERY_FILE = USE_OLD_JQUERY ?
13
'https://cdn.jsdelivr.net/npm/jquery@1.9.1/jquery.min.js' :
14
'node_modules/jquery/dist/jquery.slim.min.js'
26
const reporters = ['dots']
28
const detectBrowsers = {
30
postDetection(availableBrowser) {
32
if (process.env.CI === true) {
33
return ['ChromeHeadless']
36
if (availableBrowser.includes('Chrome')) {
37
return ['ChromeHeadless']
40
if (availableBrowser.includes('Chromium')) {
41
return ['ChromiumHeadless']
44
if (availableBrowser.includes('Firefox')) {
45
return ['FirefoxHeadless']
48
throw new Error('Please install Chrome, Chromium or Firefox')
53
'node_modules/popper.js/dist/umd/popper.min.js',
54
'node_modules/hammer-simulator/index.js'
63
concurrency: Infinity,
72
frameworks.push('detectBrowsers')
74
'karma-chrome-launcher',
75
'karma-firefox-launcher',
76
'karma-detect-browsers'
78
conf.detectBrowsers = detectBrowsers
81
'dist/js/bootstrap.js']
82
} else if (BROWSERSTACK) {
83
conf.hostname = ip.address()
85
username: process.env.BROWSER_STACK_USERNAME,
86
accessKey: process.env.BROWSER_STACK_ACCESS_KEY,
87
build: `bootstrap-v4-${new Date().toISOString()}`,
91
plugins.push('karma-browserstack-launcher')
92
conf.customLaunchers = browsers
93
conf.browsers = browsersKeys
94
reporters.push('BrowserStack')
96
'node_modules/jquery/dist/jquery.slim.min.js',
100
'js/dist/!(util|index|tooltip).js']
102
frameworks.push('detectBrowsers')
104
'karma-chrome-launcher',
105
'karma-firefox-launcher',
106
'karma-detect-browsers'
110
'js/coverage/dist/util.js',
111
'js/coverage/dist/tooltip.js',
113
'js/coverage/dist/!(util|index|tooltip).js']
114
conf.detectBrowsers = detectBrowsers
115
if (!USE_OLD_JQUERY) {
116
plugins.push('karma-coverage-istanbul-reporter')
117
reporters.push('coverage-istanbul')
118
conf.coverageIstanbulReporter = {
119
dir: path.resolve(__dirname, '../coverage/'),
120
reports: ['lcov', 'text-summary'],
134
files.push('js/tests/unit/*.js')
136
conf.frameworks = frameworks
137
conf.plugins = plugins
138
conf.reporters = reporters
141
module.exports = karmaConfig => {
142
conf.logLevel = karmaConfig.LOG_ERROR
143
karmaConfig.set(conf)