Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if(cmd.user) {
// get auth from commandline
auth = parseUser(cmd.user);
} else if(config.username && config.password) {
// get auth info from config
auth = {
username: config.username,
password: config.password
};
} else {
console.error('Authentication required. Use option "--user" or put a "username" and "password" in ' + CONFIG_FILE);
process.exit(1);
}
return browserstack.createClient(extend(settings, auth));
}
var browserstack = require("browserstack"),
config = require("./config");
var workers = [],
timeout = config.browserstack.timeout || 480, // 8 minutes
client = browserstack.createClient(config.browserstack),
osMap = {};
var loadBrowsers = function(browsers) {
browsers.forEach(function(browser, idx){
client.createWorker(browser, function(err, worker){
if(err) {
console.log(err);
console.log("Whoops! BrowserStack failed to create a worker: %s", err);
} else {
console.log(" BrowserStack "+ (browser.browser || browser.device) + " " + browser.version +" worker launched: %s", worker.id);
workers.push(worker.id);
}
});
});
},
availableBrowsers = function(cb) {
client:function () {
if (self._client) {
return self._client;
}
self._client = BrowserStack.createClient({
username:self.options().user,
password:self.options().pass
});
return self._client;
},
var BrowserStack = require( "browserstack" );
var keys = JSON.parse(require('fs').readFileSync('./keys'));
var client = BrowserStack.createClient(keys);
var async = require('async');
var Runner = {};
Runner.kill = client.terminateWorker.bind(client);
Runner.killAll = function(cb) {
client.getWorkers(function(err, workers){
if (err) {
return cb(err);
}
async.each(workers, function(worker, eachCb) {
client.terminateWorker(worker.id, eachCb);
}, function(err) {
cb(err);
exports.run = function(user_config, callback) {
callback = callback || function() {};
try {
config = new (require('../lib/config').config)(user_config);
client = BrowserStack.createClient({
username: config.username,
password: config.key
});
runTests(config, function(error, report) {
cleanUpAndExit('SIGTERM', error, report, callback);
});
} catch (e) {
callback(e);
}
};
var BrowserStackPopulator = function(settings){
this.client = browserstack.createClient(settings);
this.clients = [];
};