diff --git a/src/index.js b/src/index.js index 2c6025a5..2d96fab6 100644 --- a/src/index.js +++ b/src/index.js @@ -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}`) } diff --git a/tests/__snapshots__/index.test.js.snap b/tests/__snapshots__/index.test.js.snap index 837b6064..11b77b34 100644 --- a/tests/__snapshots__/index.test.js.snap +++ b/tests/__snapshots__/index.test.js.snap @@ -33,7 +33,7 @@ Array [ "--no-proxy-caching", "--user=foo", "--api-key=bar", - "--region=us-west", + "--region=eu-central", ], ], ] diff --git a/tests/index.test.js b/tests/index.test.js index bf984ff7..2c958c59 100644 --- a/tests/index.test.js +++ b/tests/index.test.js @@ -385,6 +385,7 @@ describe('startSauceConnect', () => { tunnelIdentifier: 'my-tunnel', 'proxy-tunnel': 'abc', verbose: true, + region: 'eu', noProxyCaching: true, logger: (log) => logs.push(log) })