sauce-connect-launcher
A library to download and launch Sauce Connect.
Installation
npm install sauce-connect-launcher
If you wish to also download Sauce Connect at this stage, rather than on first run, use the SAUCE_CONNECT_DOWNLOAD_ON_INSTALL
environment variable.
SAUCE_CONNECT_DOWNLOAD_ON_INSTALL=true npm install
Usage
Simple Usage
var sauceConnectLauncher = require('sauce-connect-launcher');
sauceConnectLauncher({
username: 'bermi',
accessKey: '12345678-1234-1234-1234-1234567890ab'
}, function (err, sauceConnectProcess) {
if (err) {
console.error(err.message);
return;
}
console.log("Sauce Connect ready");
sauceConnectProcess.close(function () {
console.log("Closed Sauce Connect process");
})
});
Advanced Usage
var sauceConnectLauncher = require('sauce-connect-launcher'),
options = {
username: 'bermi',
accessKey: '12345678-1234-1234-1234-1234567890ab',
verbose: false,
verboseDebugging: false,
vv: false,
port: null,
proxy: null,
logfile: null,
logStats: null,
maxLogsize: null,
doctor: null,
tunnelIdentifier: null,
fastFailRegexps: null,
directDomains: null,
logger: function (message) {},
readyFileId: null,
connectRetries: 0
connectRetryTimeout: 2000
downloadRetries: 0
downloadRetryTimeout: 1000
exe: null
detached: null
connectVersion: 'latest'
};
sauceConnectLauncher(options, function (err, sauceConnectProcess) {
console.log("Started Sauce Connect Process");
sauceConnectProcess.close(function () {
console.log("Closed Sauce Connect process");
});
});
Additional Sauce Connect options not specified above can still be passed. additionalArg: "foo"
options will be converted to --addtional-arg foo
args (camelCase to kebab-case). Additional option starting with dash "-additionalArg": "foo"
will be passed as it is -additionalArg foo
. Arrays will be join()
ed (like directDomains
) and boolean options will be passed as flags. See Sauce Connect's docs for a full list of arguments.
Credentials
You can pass the Sauce Labs credentials as SAUCE_USERNAME
and SAUCE_ACCESS_KEY
environment variables. (reccommended)
You can also create a user.json file in your current working directory with the username and key
user.json
{"username": "bermi", "accessKey": "12345678-1234-1234-1234-1234567890ab"}
Sauce Connect Version
You can override the default Sauce Connect version with the SAUCE_CONNECT_VERSION
environment variable.
$ SAUCE_CONNECT_VERSION=4.2 node myTestApp.js
Development
Clone the repository and run
make setup
You will be prompted for Sauce Labs credentials (used for testing). Run
make dev
to start the watcher.
Testing
npm test
or
make test
License
(The MIT License)
Copyright (c) 2013 Bermi Ferrer <bermi@bermilabs.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.