Skip to content

Commit

Permalink
feat: allow to specify options for sauce-connect
Browse files Browse the repository at this point in the history
Conflicts:
	index.js
  • Loading branch information
johanneswuerbach authored and vojtajina committed Mar 11, 2014
1 parent d1dafc4 commit f8cf523
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
14 changes: 3 additions & 11 deletions lib/sauce_connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,8 @@ var SauceConnect = function(emitter, logger) {
var alreadyRunningDefered;
var alreadyRunningProces;

this.start = function(username, accessKey, tunnelIdentifier, done) {
var options = {
username: username,
accessKey: accessKey,
verbose: false,
logfile: null,
logger: log.debug.bind(log),
no_progress: false,
tunnelIdentifier: tunnelIdentifier
};
this.start = function(connectOptions, done) {
connectOptions.logger = log.debug.bind(log);

// TODO(vojta): if different username/accessKey, start a new process
if (alreadyRunningDefered) {
Expand All @@ -25,7 +17,7 @@ var SauceConnect = function(emitter, logger) {
}

alreadyRunningDefered = q.defer();
launchSauceConnect(options, function(err, p) {
launchSauceConnect(connectOptions, function(err, p) {
if (err) {
return alreadyRunningDefered.reject(err);
}
Expand Down
9 changes: 8 additions & 1 deletion lib/sauce_launcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ var SauceLauncher = function(args, sauceConnect, /* config.sauceLabs */ config,
tunnelIdentifier = 'karma' + Math.round(new Date().getTime() / 1000);
}

var connectOptions = config.connectOptions || {};
connectOptions = helper.merge(connectOptions, {
username: username,
accessKey: accessKey,
tunnelIdentifier: tunnelIdentifier
});

this.name = browserName + ' on SauceLabs';

var pendingHeartBeat;
Expand Down Expand Up @@ -103,7 +110,7 @@ var SauceLauncher = function(args, sauceConnect, /* config.sauceLabs */ config,
}

if (startConnect) {
sauceConnect.start(username, accessKey, tunnelIdentifier).then(function() {
sauceConnect.start(connectOptions).then(function() {
if (pendingCancellations > 0) {
pendingCancellations--;
return;
Expand Down

0 comments on commit f8cf523

Please sign in to comment.