index.js
function startSauceConnect (done) {
	console.log([moment().format('HH:mm:ss:SSS')] + ' kne: Starting Sauce Connect');

	var default_options = {
		username: process.env.SAUCE_USERNAME,
		accessKey: process.env.SAUCE_ACCESS_KEY,
		connectRetries: 5,
		connectRetryTimeout: 60000,
		logger: sauceConnectLog,
		readyFileId: process.env.TRAVIS_JOB_NUMBER,
	};
	var custom_options = process.env.TRAVIS_JOB_NUMBER
		? {
			tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER,
		} : {
		};
	var options = _.extend({}, default_options, custom_options);

	sauceConnectLauncher(options, function (err, sauceConnectProcess) {
		if (err) {
			console.error([moment().format('HH:mm:ss:SSS')] + ' kne: There was an error starting Sauce Connect');
			done(err);
		} else {
			console.log([moment().format('HH:mm:ss:SSS')] + ' kne: Sauce Connect Ready');
			sauceConnection = sauceConnectProcess;
			sauceConnectionRunning = true;
			setTimeout(done, 5000);
		}
	});
}
function startSauceConnect (done) {
	console.log([moment().format('HH:mm:ss:SSS')] + ' kne: Starting Sauce Connect');

	var default_options = {
		username: process.env.SAUCE_USERNAME,
		accessKey: process.env.SAUCE_ACCESS_KEY,
		connectRetries: 5,
		connectRetryTimeout: 60000,
		logger: sauceConnectLog,
		readyFileId: process.env.TRAVIS_JOB_NUMBER,
	};
	var custom_options = process.env.TRAVIS_JOB_NUMBER
		? {
			tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER,
		} : {
		};
	var options = _.extend({}, default_options, custom_options);

	sauceConnectLauncher(options, function (err, sauceConnectProcess) {
		if (err) {
			console.error([moment().format('HH:mm:ss:SSS')] + ' kne: There was an error starting Sauce Connect');
			done(err);
		} else {
			console.log([moment().format('HH:mm:ss:SSS')] + ' kne: Sauce Connect Ready');
			sauceConnection = sauceConnectProcess;
			sauceConnectionRunning = true;
			setTimeout(done, 5000);
		}
	});
}
function startSauceConnect ( done ) { console . log ( [ moment ( ) . format ( 'HH:mm:ss:SSS' ) ] + ' kne: Starting Sauce Connect' ) ; var default_options = { username : process . env . SAUCE_USERNAME , accessKey : process . env . SAUCE_ACCESS_KEY , connectRetries : 5 , connectRetryTimeout : 60000 , logger : sauceConnectLog , readyFileId : process . env . TRAVIS_JOB_NUMBER , } ; var custom_options = process . env . TRAVIS_JOB_NUMBER ? { tunnelIdentifier : process . env . TRAVIS_JOB_NUMBER , } : { } ; var options = _ . extend ( { } , default_options , custom_options ) ; sauceConnectLauncher ( options , function ( err , sauceConnectProcess ) { if ( err ) { console . error ( [ moment ( ) . format ( 'HH:mm:ss:SSS' ) ] + ' kne: There was an error starting Sauce Connect' ) ; done ( err ) ; } else { console . log ( [ moment ( ) . format ( 'HH:mm:ss:SSS' ) ] + ' kne: Sauce Connect Ready' ) ; sauceConnection = sauceConnectProcess ; sauceConnectionRunning = true ; setTimeout ( done , 5000 ) ; } } ) ; }
Function that starts the sauce connect servers if SAUCE_ACCESS_KEY is set.
Function that starts the sauce connect servers if SAUCE_ACCESS_KEY is set .