Merge pull request #1186 from niklasvh/travis-karma

Travis karma tests
This commit is contained in:
Niklas von Hertzen 2017-08-13 14:41:27 +08:00 committed by GitHub
commit ae46010476
3 changed files with 64 additions and 32 deletions

View File

@ -5,9 +5,14 @@ env:
global: global:
- secure: eW41gIqOizwO4pTgWnAAbW75AP7F+CK9qfSed/fSh4sJ9HWMIY1YRIaY8gjr+6jV/f7XVHcXuym6ZxgINYSkVKbF1JKxBJNLOXtSgNbVHSic58pYFvUjwxIBI9aPig9uux1+DbnpWqXFDTcACJSevQZE0xwmjdrSkDLgB0G34v8= - secure: eW41gIqOizwO4pTgWnAAbW75AP7F+CK9qfSed/fSh4sJ9HWMIY1YRIaY8gjr+6jV/f7XVHcXuym6ZxgINYSkVKbF1JKxBJNLOXtSgNbVHSic58pYFvUjwxIBI9aPig9uux1+DbnpWqXFDTcACJSevQZE0xwmjdrSkDLgB0G34v8=
- secure: Y2Av+Gd3z9uQEB36GwdOOuGka0hx0/HeitASEo59z934O8RxnmN9eNTXS7dDT3XtKtwxIyLTOEpS7qlRdWahH28hr/dS4xJj6ao58C+1xMcDs6NAPGmDxUlcJWpcGEsnjmXjQCc3fBioSTdpIBrK/gdvgpNh77UKG74Sk7Z+YGk= - secure: Y2Av+Gd3z9uQEB36GwdOOuGka0hx0/HeitASEo59z934O8RxnmN9eNTXS7dDT3XtKtwxIyLTOEpS7qlRdWahH28hr/dS4xJj6ao58C+1xMcDs6NAPGmDxUlcJWpcGEsnjmXjQCc3fBioSTdpIBrK/gdvgpNh77UKG74Sk7Z+YGk=
- secure: YI+YbTOGf2x4fPMKW+KhJiZWswoXT6xOKGwLfsQsVwmFX1LerJouil5D5iYOQuL4FE3pNaoJSNakIsokJQuGKJMmnPc8rdhMZuBJBk6MRghurE2Xe9qBHfuUBPlfD61nARESm4WDcyMwM0QVYaOKeY6aIpZ91qbUbyc60EEx3C4=
addons: addons:
sauce_connect: true chrome: stable
firefox: latest
dist: trusty
sudo: false
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
notifications: notifications:
webhooks: webhooks:
urls: urls:

View File

@ -2,8 +2,54 @@
// Generated on Sat Aug 05 2017 23:42:26 GMT+0800 (Malay Peninsula Standard Time) // Generated on Sat Aug 05 2017 23:42:26 GMT+0800 (Malay Peninsula Standard Time)
const port = 9876; const port = 9876;
module.exports = function(config) { module.exports = function(config) {
const slLaunchers = (!process.env.SAUCE_USERNAME || !process.env.SAUCE_ACCESS_KEY) ? {} : {
sl_beta_chrome: {
base: 'SauceLabs',
browserName: 'chrome',
platform: 'Windows 10',
version: 'beta'
},
sl_stable_firefox: {
base: 'SauceLabs',
browserName: 'firefox',
platform: 'Windows 10'
},
sl_ie9: {
base: 'SauceLabs',
browserName: 'internet explorer',
version: '9.0',
platform: 'Windows 7'
},
sl_ie10: {
base: 'SauceLabs',
browserName: 'internet explorer',
version: '10.0',
platform: 'Windows 7'
},
sl_ie11: {
base: 'SauceLabs',
browserName: 'internet explorer',
version: '11.0',
platform: 'Windows 7'
},
sl_edge: {
base: 'SauceLabs',
browserName: 'MicrosoftEdge',
version: '15.15063',
platform: 'Windows 10'
}
};
const customLaunchers = Object.assign({}, slLaunchers, {
stable_chrome: {
base: 'Chrome'
},
stable_firefox: {
base: 'Firefox'
}
});
config.set({ config.set({
// base path that will be used to resolve all patterns (eg. files, exclude) // base path that will be used to resolve all patterns (eg. files, exclude)
@ -17,7 +63,7 @@ module.exports = function(config) {
// list of files / patterns to load in the browser // list of files / patterns to load in the browser
files: [ files: [
'tests/testrunner.js', 'build/testrunner.js',
{ pattern: './tests/**/*', 'watched': true, 'included': false, 'served': true}, { pattern: './tests/**/*', 'watched': true, 'included': false, 'served': true},
{ pattern: './dist/**/*', 'watched': true, 'included': false, 'served': true}, { pattern: './dist/**/*', 'watched': true, 'included': false, 'served': true},
{ pattern: './node_modules/**/*', 'watched': true, 'included': false, 'served': true} { pattern: './node_modules/**/*', 'watched': true, 'included': false, 'served': true}
@ -38,8 +84,7 @@ module.exports = function(config) {
// test results reporter to use // test results reporter to use
// possible values: 'dots', 'progress' // possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter // available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'], reporters: ['dots', 'saucelabs'],
// web server port // web server port
port, port,
@ -60,37 +105,18 @@ module.exports = function(config) {
// start these browsers // start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: [ browsers: Object.keys(customLaunchers),
'Chrome',
'Firefox',
'IE9',
'IE10',
'IE11',
'Edge'
],
customLaunchers: { customLaunchers,
IE9: {
base: 'IE',
'x-ua-compatible': 'IE=EmulateIE9'
},
IE10: {
base: 'IE',
'x-ua-compatible': 'IE=EmulateIE10'
},
IE11: {
base: 'IE'
}
},
// Continuous Integration mode // Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits // if true, Karma captures browsers, runs the tests and exits
singleRun: false, singleRun: true,
// Concurrency level // Concurrency level
// how many browser should be started simultaneous // how many browser should be started simultaneous
concurrency: Infinity, concurrency: 5,
proxies: { proxies: {
'/dist': `http://localhost:${port}/base/dist`, '/dist': `http://localhost:${port}/base/dist`,
@ -106,6 +132,6 @@ module.exports = function(config) {
} }
}, },
browserNoActivityTimeout: 30000 browserNoActivityTimeout: 120000
}) })
}; };

View File

@ -43,6 +43,7 @@
"karma-firefox-launcher": "1.0.1", "karma-firefox-launcher": "1.0.1",
"karma-ie-launcher": "1.0.0", "karma-ie-launcher": "1.0.0",
"karma-mocha": "1.3.0", "karma-mocha": "1.3.0",
"karma-sauce-launcher": "1.1.0",
"mocha": "3.5.0", "mocha": "3.5.0",
"prettier": "1.5.3", "prettier": "1.5.3",
"promise-polyfill": "6.0.2", "promise-polyfill": "6.0.2",
@ -57,8 +58,8 @@
"format": "prettier --single-quote --no-bracket-spacing --tab-width 4 --print-width 100 --write \"{src,tests,scripts}/**/*.js\"", "format": "prettier --single-quote --no-bracket-spacing --tab-width 4 --print-width 100 --write \"{src,tests,scripts}/**/*.js\"",
"flow": "flow", "flow": "flow",
"lint": "eslint src/**", "lint": "eslint src/**",
"test": "npm run flow && npm run lint", "test": "npm run flow && npm run lint && npm run karma",
"karma": "karma start karma.conf.js", "karma": "karma start --single-run",
"watch": "webpack --progress --colors --watch" "watch": "webpack --progress --colors --watch"
}, },
"homepage": "https://html2canvas.hertzen.com", "homepage": "https://html2canvas.hertzen.com",