mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-12 08:34:08 +02:00
fix bundle and run test against it
This commit is contained in:
@@ -17,6 +17,7 @@ const plugins = [
|
|||||||
'defineProperties',
|
'defineProperties',
|
||||||
'createClass',
|
'createClass',
|
||||||
'inheritsLoose',
|
'inheritsLoose',
|
||||||
|
'defineProperty',
|
||||||
'objectSpread'
|
'objectSpread'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
53
js/tests/karma-bundle.conf.js
Normal file
53
js/tests/karma-bundle.conf.js
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
/* 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' : '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,
|
||||||
|
'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')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
@@ -6,7 +6,8 @@
|
|||||||
},
|
},
|
||||||
"globals": {
|
"globals": {
|
||||||
"sinon": false,
|
"sinon": false,
|
||||||
"Util": false
|
"Util": false,
|
||||||
|
"bootstrap": false
|
||||||
},
|
},
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"ecmaVersion": 5,
|
"ecmaVersion": 5,
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
$(function () {
|
$(function () {
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
|
window.Util = typeof bootstrap !== 'undefined' ? bootstrap.Util : Util
|
||||||
|
|
||||||
QUnit.module('util')
|
QUnit.module('util')
|
||||||
|
|
||||||
QUnit.test('Util.getSelectorFromElement should return the correct element', function (assert) {
|
QUnit.test('Util.getSelectorFromElement should return the correct element', function (assert) {
|
||||||
|
@@ -47,6 +47,8 @@
|
|||||||
"js-test": "npm-run-all --parallel js-test-karma*",
|
"js-test": "npm-run-all --parallel js-test-karma*",
|
||||||
"js-test-karma": "karma start js/tests/karma.conf.js",
|
"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-old": "cross-env USE_OLD_JQUERY=true npm run js-test-karma",
|
||||||
|
"js-test-karma-bundle": "cross-env karma start js/tests/karma-bundle.conf.js",
|
||||||
|
"js-test-karma-bundle-old": "cross-env USE_OLD_JQUERY=true npm run js-test-karma-bundle",
|
||||||
"js-test-cloud": "ruby -r webrick -e \"s = WEBrick::HTTPServer.new(:Port => 3000, :DocumentRoot => Dir.pwd, :Logger => WEBrick::Log.new('/dev/null'), :AccessLog => []); trap('INT') { s.shutdown }; s.start\" & node build/saucelabs-unit-test.js",
|
"js-test-cloud": "ruby -r webrick -e \"s = WEBrick::HTTPServer.new(:Port => 3000, :DocumentRoot => Dir.pwd, :Logger => WEBrick::Log.new('/dev/null'), :AccessLog => []); trap('INT') { s.shutdown }; s.start\" & node build/saucelabs-unit-test.js",
|
||||||
"docs": "npm-run-all --parallel css-docs js-docs --sequential docs-compile docs-lint",
|
"docs": "npm-run-all --parallel css-docs js-docs --sequential docs-compile docs-lint",
|
||||||
"docs-compile": "bundle exec jekyll build",
|
"docs-compile": "bundle exec jekyll build",
|
||||||
|
Reference in New Issue
Block a user