sauce-connect-launcher
A library to download and launch Sauce Connect.
Last updated 11 years ago by bermi .
Repository · Bugs · Original npm · Tarball · package.json
$ npm install sauce-connect-launcher 
SYNC missed versions from official npm registry.

sauce-connect-launcher

Build Status Dependency Status

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 = {

    // Sauce Labs username.  You can also pass this through the
    // SAUCE_USERNAME environment variable
    username: 'bermi',

    // Sauce Labs access key.  You can also pass this through the
    // SAUCE_ACCESS_KEY environment variable
    accessKey: '12345678-1234-1234-1234-1234567890ab',

    // Log output from the `sc` process to stdout?
    verbose: false,

    // Enable verbose debugging (optional)
    verboseDebugging: false,

    // Together with verbose debugging will output HTTP headers as well (optional)
    vv: false,

    // Port on which Sauce Connect's Selenium relay will listen for
    // requests. Default 4445. (optional)
    port: null,

    // Proxy host and port that Sauce Connect should use to connect to
    // the Sauce Labs cloud. e.g. "localhost:1234" (optional)
    proxy: null,

    // Change sauce connect logfile location (optional)
    logfile: null,

    // Period to log statistics about HTTP traffic in seconds (optional)
    logStats: null,

    // Maximum size before which the logfile is rotated (optional)
    maxLogsize: null,

    // Set to true to perform checks to detect possible misconfiguration or problems (optional)
    doctor: null,

    // Identity the tunnel for concurrent tunnels (optional)
    tunnelIdentifier: null,

    // an array or comma-separated list of regexes whose matches
    // will not go through the tunnel. (optional)
    fastFailRegexps: null,

    // an array or comma-separated list of domains that will not go
    // through the tunnel. (optional)
    directDomains: null,

    // A function to optionally write sauce-connect-launcher log messages.
    // e.g. `console.log`.  (optional)
    logger: function (message) {},

    // an optional suffix to be appended to the `readyFile` name.
    // useful when running multiple tunnels on the same machine,
    // such as in a continuous integration environment. (optional)
    readyFileId: null,

    // retry to establish a tunnel multiple times. (optional)
    connectRetries: 0

    // time to wait between connection retries in ms. (optional)
    connectRetryTimeout: 2000

    // retry to download the sauce connect archive multiple times. (optional)
    downloadRetries: 0

    // time to wait between download retries in ms. (optional)
    downloadRetryTimeout: 1000

    // path to a sauce connect executable (optional)
    // by default the latest sauce connect version is downloaded
    exe: null

    // keep sc running after the node process exited, this means you need to close
    // the process manually once you are done using the pidfile
    // Attention: This works only on macOS and linux at the moment
    detached: null

    // specify a connect version instead of fetching the latest version, this currently
    // does not support checksum verification
    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.

Current Tags

  • 1.3.2                                ...           latest (5 years ago)

65 Versions

  • 1.3.2                                ...           5 years ago
  • 1.3.1                                ...           5 years ago
  • 1.3.0                                ...           5 years ago
  • 1.2.7                                ...           5 years ago
  • 1.2.6                                ...           6 years ago
  • 1.2.5                                ...           6 years ago
  • 1.2.4                                ...           7 years ago
  • 1.2.3                                ...           7 years ago
  • 1.2.2                                ...           8 years ago
  • 1.2.1                                ...           8 years ago
  • 1.2.0                                ...           8 years ago
  • 1.1.1                                ...           8 years ago
  • 1.1.0                                ...           8 years ago
  • 1.0.0                                ...           8 years ago
  • 0.17.0                                ...           8 years ago
  • 0.16.0                                ...           8 years ago
  • 0.15.1                                ...           8 years ago
  • 0.15.0                                ...           8 years ago
  • 0.14.0                                ...           9 years ago
  • 0.13.0                                ...           9 years ago
  • 0.12.0                                ...           9 years ago
  • 0.11.1                                ...           10 years ago
  • 0.11.0                                ...           10 years ago
  • 0.10.3                                ...           10 years ago
  • 0.10.2                                ...           10 years ago
  • 0.10.1                                ...           10 years ago
  • 0.10.0                                ...           10 years ago
  • 0.9.3                                ...           10 years ago
  • 0.9.2                                ...           10 years ago
  • 0.9.1                                ...           10 years ago
  • 0.9.0                                ...           10 years ago
  • 0.8.2                                ...           10 years ago
  • 0.8.1                                ...           10 years ago
  • 0.8.0                                ...           10 years ago
  • 0.7.1                                ...           10 years ago
  • 0.7.0                                ...           10 years ago
  • 0.6.1                                ...           10 years ago
  • 0.6.0                                ...           10 years ago
  • 0.5.2                                ...           10 years ago
  • 0.5.1                                ...           10 years ago
  • 0.5.0                                ...           10 years ago
  • 0.4.2                                ...           11 years ago
  • 0.4.1                                ...           11 years ago
  • 0.3.5                                ...           11 years ago
  • 0.4.0                                ...           11 years ago
  • 0.3.3                                ...           11 years ago
  • 0.3.2                                ...           11 years ago
  • 0.3.1                                ...           11 years ago
  • 0.3.0                                ...           11 years ago
  • 0.2.2                                ...           11 years ago
  • 0.2.1                                ...           11 years ago
  • 0.2.0                                ...           11 years ago
  • 0.1.11                                ...           11 years ago
  • 0.1.10                                ...           11 years ago
  • 0.1.9                                ...           11 years ago
  • 0.1.8                                ...           11 years ago
  • 0.1.7                                ...           11 years ago
  • 0.1.6                                ...           11 years ago
  • 0.1.5                                ...           11 years ago
  • 0.1.4                                ...           11 years ago
  • 0.1.3                                ...           12 years ago
  • 0.1.2                                ...           12 years ago
  • 0.1.1                                ...           12 years ago
  • 0.1.0                                ...           12 years ago
  • 0.0.1                                ...           12 years ago
Maintainers (2)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (10)
Dependents (2)

© 2010 - cnpmjs.org x YWFE | Home | YWFE