Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bootstrap
bootstrap
Commits
9efed825
Commit
9efed825
authored
6 years ago
by
Johann-S
Browse files
Options
Download
Email Patches
Plain Diff
refactor karma config in one file
parent
c543f360
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
js/tests/karma-browserstack.conf.js
+0
-51
js/tests/karma-browserstack.conf.js
js/tests/karma-bundle.conf.js
+0
-53
js/tests/karma-bundle.conf.js
js/tests/karma.conf.js
+128
-65
js/tests/karma.conf.js
package.json
+3
-3
package.json
with
131 additions
and
172 deletions
+131
-172
js/tests/karma-browserstack.conf.js
deleted
100644 → 0
+
0
-
51
View file @
c543f360
/* eslint-env node */
/* eslint no-process-env: 0 */
const
ip
=
require
(
'
ip
'
)
const
{
browsers
,
browsersKeys
}
=
require
(
'
./browsers
'
)
module
.
exports
=
(
config
)
=>
{
config
.
set
({
hostname
:
ip
.
address
(),
browserStack
:
{
username
:
process
.
env
.
BROWSER_STACK_USERNAME
,
accessKey
:
process
.
env
.
BROWSER_STACK_ACCESS_KEY
,
build
:
`bootstrap-
${
new
Date
().
toISOString
()}
`
,
project
:
'
Bootstrap
'
,
retryLimit
:
2
},
basePath
:
'
../..
'
,
frameworks
:
[
'
qunit
'
,
'
sinon
'
],
plugins
:
[
'
karma-qunit
'
,
'
karma-sinon
'
,
'
karma-browserstack-launcher
'
],
// list of files / patterns to load in the browser
files
:
[
'
site/docs/4.1/assets/js/vendor/jquery-slim.min.js
'
,
'
site/docs/4.1/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/tests/unit/*.js
'
],
customLaunchers
:
browsers
,
browsers
:
browsersKeys
,
reporters
:
[
'
dots
'
,
'
BrowserStack
'
],
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
,
singleRun
:
true
,
concurrency
:
Infinity
,
client
:
{
qunit
:
{
showUI
:
true
}
}
})
}
This diff is collapsed.
Click to expand it.
js/tests/karma-bundle.conf.js
deleted
100644 → 0
+
0
-
53
View file @
c543f360
/* eslint-env node */
/* eslint no-process-env: 0 */
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
'
],
// list of files / patterns to load in the browser
files
:
[
jqueryFile
,
'
site/docs/4.1/assets/js/vendor/popper.min.js
'
,
'
dist/js/bootstrap.js
'
,
'
js/tests/unit/*.js
'
],
reporters
:
[
'
dots
'
],
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
'
)
}
}
})
}
This diff is collapsed.
Click to expand it.
js/tests/karma.conf.js
+
128
-
65
View file @
9efed825
/* eslint-env node */
/* eslint no-process-env: 0 */
const
ip
=
require
(
'
ip
'
)
const
{
browsers
,
browsersKeys
}
=
require
(
'
./browsers
'
)
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
'
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
'
const
bundle
=
process
.
env
.
BUNDLE
===
'
true
'
const
browserStack
=
process
.
env
.
BROWSER
===
'
true
'
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
'
]
}
const
frameworks
=
[
'
qunit
'
,
'
sinon
'
]
if
(
availableBrowser
.
includes
(
'
Firefox
'
))
{
return
[
'
FirefoxHeadless
'
]
}
const
plugins
=
[
'
karma-qunit
'
,
'
karma-sinon
'
]
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
const
reporters
=
[
'
dots
'
]
const
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
'
)
}
}
const
customLaunchers
=
{
FirefoxHeadless
:
{
base
:
'
Firefox
'
,
flags
:
[
'
-headless
'
]
}
}
let
files
=
[
'
site/docs/4.1/assets/js/vendor/popper.min.js
'
]
const
conf
=
{
basePath
:
'
../..
'
,
port
:
9876
,
colors
:
true
,
autoWatch
:
false
,
singleRun
:
true
,
concurrency
:
Infinity
,
client
:
{
qunit
:
{
showUI
:
true
}
}
}
if
(
bundle
)
{
frameworks
.
push
(
'
detectBrowsers
'
)
plugins
.
push
(
'
karma-chrome-launcher
'
,
'
karma-firefox-launcher
'
,
'
karma-detect-browsers
'
)
conf
.
customLaunchers
=
customLaunchers
conf
.
detectBrowsers
=
detectBrowsers
files
=
files
.
concat
([
jqueryFile
,
'
dist/js/bootstrap.js
'
])
}
else
if
(
browserStack
)
{
conf
.
hostname
=
ip
.
address
()
conf
.
browserStack
=
{
username
:
process
.
env
.
BROWSER_STACK_USERNAME
,
accessKey
:
process
.
env
.
BROWSER_STACK_ACCESS_KEY
,
build
:
`bootstrap-
${
new
Date
().
toISOString
()}
`
,
project
:
'
Bootstrap
'
,
retryLimit
:
2
}
plugins
.
push
(
'
karma-browserstack-launcher
'
)
conf
.
customLaunchers
=
browsers
conf
.
browsers
=
browsersKeys
reporters
.
push
(
'
BrowserStack
'
)
files
=
files
.
concat
([
'
site/docs/4.1/assets/js/vendor/jquery-slim.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
])
}
else
{
frameworks
.
push
(
'
detectBrowsers
'
)
plugins
.
push
(
'
karma-chrome-launcher
'
,
'
karma-firefox-launcher
'
,
'
karma-detect-browsers
'
,
'
karma-coverage-istanbul-reporter
'
)
files
=
files
.
concat
([
jqueryFile
,
'
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
])
reporters
.
push
(
'
coverage-istanbul
'
)
conf
.
customLaunchers
=
customLaunchers
conf
.
detectBrowsers
=
detectBrowsers
conf
.
coverageIstanbulReporter
=
{
dir
:
jsCoveragePath
,
reports
:
[
'
lcov
'
,
'
text-summary
'
],
thresholds
:
{
emitWarning
:
false
,
global
:
{
statements
:
90
,
branches
:
84
,
functions
:
87
,
lines
:
90
}
}
})
}
}
files
.
push
(
'
js/tests/unit/*.js
'
)
conf
.
frameworks
=
frameworks
conf
.
plugins
=
plugins
conf
.
reporters
=
reporters
conf
.
files
=
files
module
.
exports
=
(
karmaConfig
)
=>
{
// possible values: karmaConfig.LOG_DISABLE || karmaConfig.LOG_ERROR || karmaConfig.LOG_WARN || karmaConfig.LOG_INFO || karmaConfig.LOG_DEBUG
conf
.
logLevel
=
karmaConfig
.
LOG_ERROR
||
karmaConfig
.
LOG_WARN
karmaConfig
.
set
(
conf
)
}
This diff is collapsed.
Click to expand it.
package.json
+
3
-
3
View file @
9efed825
...
...
@@ -53,9 +53,9 @@
"js-test"
:
"npm-run-all js-test-karma*"
,
"js-test-karma"
:
"karma start js/tests/karma.conf.js"
,
"js-test-karma-old"
:
"cross-env USE_OLD_JQUERY=true npm run js-test-karma"
,
"js-test-karma-bundle"
:
"cross-env
karma start
js
/
test
s/
karma
-bundle.conf.js
"
,
"js-test-karma-bundle-old"
:
"cross-env USE_OLD_JQUERY=true npm run js-test-karma
-bundle
"
,
"js-test-cloud"
:
"
karma start
js
/
test
s/
karma
-browserstack.conf.js
"
,
"js-test-karma-bundle"
:
"cross-env
BUNDLE=true npm run
js
-
test
-
karma"
,
"js-test-karma-bundle-old"
:
"cross-env
BUNDLE=true
USE_OLD_JQUERY=true npm run js-test-karma"
,
"js-test-cloud"
:
"
cross-env BROWSER=true npm run
js
-
test
-
karma"
,
"coveralls"
:
"shx cat js/coverage/lcov.info | coveralls"
,
"docs"
:
"npm-run-all --parallel css-docs js-docs --sequential docs-compile docs-lint"
,
"docs-compile"
:
"bundle exec jekyll build"
,
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment