Skip to content

Commit

Permalink
Fixing master build on Travis (#1126)
Browse files Browse the repository at this point in the history
* Use Travis sauce connect addon to connect to Sauce Labs

* Set Windows 7 as platform for testing IE11 on Sauce Labs

* Use ALLOW_SAUCELABS env variable to control Sauce Labs availability

* Run karma sauce tests only once in case of multiple node versions being used on Travis
  • Loading branch information
mkxml committed May 29, 2018
1 parent cd422d0 commit 2364da5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
9 changes: 7 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@ before_install:
install:
- npm install

addons:
sauce_connect: true

script:
- npm run build
- COVERAGE=true npm run test
- COVERAGE=false FLAKEY=false PERFORMANCE=false npm run test:karma
- COVERAGE=true ALLOW_SAUCELABS=false npm run test
- if [ "$TRAVIS_NODE_VERSION" = "8" ]; then
COVERAGE=false FLAKEY=false PERFORMANCE=false ALLOW_SAUCELABS=true npm run test:karma;
fi
- ./node_modules/coveralls/bin/coveralls.js < ./coverage/lcov.info
21 changes: 13 additions & 8 deletions test/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*eslint no-var:0, object-shorthand:0 */

var coverage = String(process.env.COVERAGE) === 'true',
ci = String(process.env.CI).match(/^(1|true)$/gi),
allowSauce = !String(process.env.ALLOW_SAUCELABS).match(/^(0|false|undefined)$/gi),
pullRequest = !String(process.env.TRAVIS_PULL_REQUEST).match(/^(0|false|undefined)$/gi),
masterBranch = String(process.env.TRAVIS_BRANCH).match(/^master$/gi),
sauceLabs = ci && !pullRequest && masterBranch,
sauceLabs = allowSauce && !pullRequest && masterBranch,
performance = !coverage && String(process.env.PERFORMANCE)!=='false',
webpack = require('webpack');

Expand Down Expand Up @@ -32,8 +32,8 @@ var sauceLabsLaunchers = {
sl_ie_11: {
base: 'SauceLabs',
browserName: 'internet explorer',
version: '11.103',
platform: 'Windows 10'
version: '11.0',
platform: 'Windows 7'
}
};

Expand Down Expand Up @@ -85,10 +85,15 @@ module.exports = function(config) {
// Use only two browsers concurrently, works better with open source Sauce Labs remote testing
concurrency: 2,

// sauceLabs: {
// tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER || ('local'+require('./package.json').version),
// startConnect: false
// },
captureTimeout: 0,

sauceLabs: {
build: 'CI #' + process.env.TRAVIS_BUILD_NUMBER + ' (' + process.env.TRAVIS_BUILD_ID + ')',
tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER || ('local'+require('../package.json').version),
connectLocationForSERelay: 'localhost',
connectPortForSERelay: 4445,
startConnect: false
},

customLaunchers: sauceLabs ? sauceLabsLaunchers : localLaunchers,

Expand Down

0 comments on commit 2364da5

Please sign in to comment.