Code Monkey home page Code Monkey logo

node-sauce-connect's Introduction

Build Status Build status Code Climate npm npm version

Node Sauce Connect

Note

The reason for creating this package was I'm working in an enterprise environment and I wanted a simple way to grab sauce connect from a local nexus repository on npm install. sauce-connect-launcher does this but felt extremely heavyweight and there was no way to specify where to download from.

Installing

npm install node-sauce-connect

Custom Binary Download Url

To use a mirror of the Sauce Connect binaries use npm config property sauceconnect_cdnurl. Default is https://saucelabs.com/downloads.

npm install node-sauce-connect --sauceconnect_cdnurl=https://your.url/sauceconnect

Or add property into your .npmrc file.

sauceconnect_cdnurl=https://your.url/sauceconnect

Custom Certificate Authority

Sometimes on internal networks certificates are self signed by the organization which causes errors when downloading. You can use the the following .npmrc config settings to force node-sauce-connect to trust these certificate authorities.

cafile=/path/to/certificate.crt

You can also provide the certificate as a string to node-sauce-connect by using the ca setting

ca="-----BEGIN CERTIFICATE-----\nMIID0zCCArugAwIBAgI...."

Disable Strict SSL Mode

Strict SSL environment variables are also respected, this means node-sauce-connect will ignore any SSL errors that are thrown when downloading when the strict-ssl property is in your .npmrc file.

strict-ssl=false

Obfuscation of HTTP(S)_PROXY basic auth

On install node-sauce-connect will log out the HTTP_PROXY and HTTPS_PROXY env vars to help in debugging. By default it obfuscates the username and password. If you require to see what is being used then

npm install node-sauce-connect --node_sauce_connect_debug=TRUE

Or add property into your .npmrc file.

node_sauce_connect_debug=TRUE

Running

bin/sc [arguments]

If installed via npm there will be a symlink placed in node_modules/.bin you can execute by placing the following in your package.json file.

{
    "scripts": {
      "test": "npm run sc && [test util]",
      "sc": "sc [arguments]"
    }
}

Running via Node

The package exports a path string that contains the path to the Sauce Connect binary/executable.

Below is an example of using this package via node.

var childProcess = require('child_process');
var sauceConnect = require('node-sauce-connect');
var binPath = sauceConnect.path;

var childArgs = [
    // optional arguments
];

function logger(data) {
  console.log(data);
}

var instance = childProcess.spawn(binPath, childArgs);

instance.stdout.on('data', logger);                   
instance.on('data', logger);

// run your tests

instance.kill();

You can also use the start and stop methods for convenience (this only works for one instance):

var sauceConnect = require('node-sauce-connect');

args = [
	// optional arguments
];

function logger(data) {
  console.log(data);
}

sauceConnect.start(args);

sauceConnect.defaultInstance.stdout.on('data', logger);                   
sauceConnect.defaultInstance.on('data', logger);

// run your tests

sauceConnect.stop();

Note: if your tests are ran asynchronously, sauceConnect.stop() will have to be executed as a callback at the end of your tests.

Versioning

The NPM package version tracks the version of Sauce Connect that will be installed, there is also the possibility of an additional number (eg. 4.5.51) that will be used used for revisions to the installer.

Node Version Support

The package has been tested with latest versions of Node 4, 5, 6, 7, 8 and 9.

Author

Barry Allwood

This project is completely inspired by and borrows heavily from the chromedriver project (even the readme) and sauce-connect-launcher project.

License

Licensed under the Apache License, Version 2.0.

node-sauce-connect's People

Contributors

ballwood avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.