Skip to content

Commit

Permalink
respect region param - fixes webdriverio/webdriverio#7637
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-bromann committed Nov 3, 2021
1 parent 053adfc commit 1ed742f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,9 @@ export default class SauceLabs {
args.push(`--user=${this.username}`)
args.push(`--api-key=${this._accessKey}`)

if (!args.some(arg => arg.startsWith('--region'))) {
const scRegion = getRegionSubDomain(this.region)
const region = argv.region || this.region
if (region) {
const scRegion = getRegionSubDomain({ region })
.split('-').slice(0, 2).join('-')
args.push(`--region=${scRegion}`)
}
Expand Down
2 changes: 1 addition & 1 deletion tests/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Array [
"--no-proxy-caching",
"--user=foo",
"--api-key=bar",
"--region=us-west",
"--region=eu-central",
],
],
]
Expand Down
1 change: 1 addition & 0 deletions tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ describe('startSauceConnect', () => {
tunnelIdentifier: 'my-tunnel',
'proxy-tunnel': 'abc',
verbose: true,
region: 'eu',
noProxyCaching: true,
logger: (log) => logs.push(log)
})
Expand Down

0 comments on commit 1ed742f

Please sign in to comment.