Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

Commit

Permalink
Merge pull request #173 from johnjbarton/options-check
Browse files Browse the repository at this point in the history
feature(config): exit with info if missing username/password
  • Loading branch information
kalamcs committed May 15, 2020
2 parents 5a5aa59 + 6cb2734 commit c8f10d5
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ var createBrowserStackClient = function (/* config.browserStack */config, /* Bro
password: env.BROWSERSTACK_ACCESS_KEY || env.BROWSER_STACK_ACCESS_KEY || config.accessKey
}

if (!options.username) {
console.error('No browserstack username!')
console.error(' Set username via env.BROWSERSTACK_USERNAME, env.BROWSER_STACK_USERNAME, or config.username.')
}

if (!options.password) {
console.error('No browserstack password!')
console.error(' Set username via env.BROWSERSTACK_ACCESS_KEY, env.BROWSER_STACK_ACCESS_KEY, or config.accessKey.')
}

if (!options.username || !options.password) {
process.exit(1)
}

if (config.proxyHost && config.proxyPort) {
config.proxyProtocol = config.proxyProtocol || 'http'
var proxyAuth = (config.proxyUser && config.proxyPass)
Expand All @@ -64,7 +78,6 @@ var createBrowserStackClient = function (/* config.browserStack */config, /* Bro
proxy: options.proxy
}

// TODO(vojta): handle no username/pwd
var client = api.createClient(options)

var pollingTimeout = config.pollingTimeout || 1000
Expand Down

0 comments on commit c8f10d5

Please sign in to comment.