Skip to content

Commit

Permalink
try different strategy for avoiding insecure sauce connect
Browse files Browse the repository at this point in the history
  • Loading branch information
boneskull committed May 23, 2016
1 parent f8a3d86 commit 9e8cbaa
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 56 deletions.
6 changes: 0 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ before_install:

script: travis_retry make $TARGET

addons:
sauce_connect:
username: mochajs
access_key:
secure: R0HXKtR6F2iDEnItv57BTRyL64XfyIlyyluPLK8G33O/InaQjT3KxGuxevz3nVYIqqnI1MPjYodXcQaqrBOLUVmA2vhBeMHB2OwGc9GAL+HBtB1fh+bQJelkl/XMcTTbC5LIZ6nZjmFnkmjqT3AmUhdDRISgieIFeVY4x48LfiU=

notifications:
urls:
# for gitter
Expand Down
105 changes: 55 additions & 50 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,50 @@
'use strict';

function addSauceTests(cfg) {
cfg.reporters.push('saucelabs');
cfg.customLaunchers = {
ie8: {
base: 'SauceLabs',
browserName: 'internet explorer',
platform: 'Windows 7',
version: '8.0'
},
chrome: {
base: 'SauceLabs',
browserName: 'chrome',
platform: 'Windows 8',
version: 'latest'
},
edge: {
base: 'SauceLabs',
browserName: 'MicrosoftEdge',
platform: 'Windows 10',
version: 'latest'
},
firefox: {
base: 'SauceLabs',
browserName: 'firefox',
platform: 'Windows 8.1',
version: 'latest'
},
safari: {
base: 'SauceLabs',
browserName: 'safari',
platform: 'OS X 10.11',
version: 'latest'
}
};

cfg.browsers = cfg.browsers.concat(Object.keys(cfg.customLaunchers));

cfg.sauceLabs = {
public: 'public'
};

// for slow browser booting, ostensibly
cfg.captureTimeout = 120000;
}

module.exports = function(config) {
var cfg = {
frameworks: [
Expand Down Expand Up @@ -41,68 +86,28 @@ module.exports = function(config) {
// TO RUN LOCALLY:
// Execute `CI=1 make test-browser`, once you've set the SAUCE_USERNAME and
// SAUCE_ACCESS_KEY env vars.
// also, we can't run SauceLabs tests on PRs from forks.
if (process.env.CI) {
if (!(process.env.SAUCE_USERNAME || process.env.SAUCE_ACCESS_KEY)) {
throw new Error('Must set SAUCE_USERNAME and SAUCE_ACCESS_KEY '
+ 'environment variables!');
}
cfg.reporters.push('saucelabs');
cfg.customLaunchers = {
ie8: {
base: 'SauceLabs',
browserName: 'internet explorer',
platform: 'Windows 7',
version: '8.0'
},
chrome: {
base: 'SauceLabs',
browserName: 'chrome',
platform: 'Windows 8',
version: 'latest'
},
edge: {
base: 'SauceLabs',
browserName: 'MicrosoftEdge',
platform: 'Windows 10',
version: 'latest'
},
firefox: {
base: 'SauceLabs',
browserName: 'firefox',
platform: 'Windows 8.1',
version: 'latest'
},
safari: {
base: 'SauceLabs',
browserName: 'safari',
platform: 'OS X 10.11',
version: 'latest'
}
};

cfg.browsers = cfg.browsers.concat(Object.keys(cfg.customLaunchers));

cfg.sauceLabs = {
public: 'public'
};

// we can't run SauceLabs tests on PRs from forks on Travis cuz security.
if (process.env.TRAVIS) {
if (process.env.TRAVIS_REPO_SLUG === 'mochajs/mocha'
&& process.env.TRAVIS_PULL_REQUEST === 'false') {
addSauceTests(cfg);
// correlate build/tunnel with Travis
cfg.sauceLabs.build = 'TRAVIS #' + process.env.TRAVIS_BUILD_NUMBER
+ ' (' + process.env.TRAVIS_BUILD_ID + ')';
cfg.sauceLabs.tunnelIdentifier = process.env.TRAVIS_JOB_NUMBER;
cfg.sauceLabs.startConnect = false;
cfg.sauceLabs.startConnect = true;
}
} else {
// otherwise just make something up
if (!(process.env.SAUCE_USERNAME || process.env.SAUCE_ACCESS_KEY)) {
throw new Error('Must set SAUCE_USERNAME and SAUCE_ACCESS_KEY '
+ 'environment variables!');
}

// remember, this is for a local run.
addSauceTests(cfg);
cfg.sauceLabs.build = require('os').hostname() + ' (' + Date.now() + ')';
}

// for slow browser booting, ostensibly
cfg.captureTimeout = 120000;
}

// the MOCHA_UI env var will determine if we're running interface-specific
Expand Down

0 comments on commit 9e8cbaa

Please sign in to comment.