Browser ID not appended when specifying browser-specific URL
Background
When testing real iOS devices on BrowserStack, URLs that have the localhost domain get redirected to bs-local.com. At the time of this writing, it appears as though BrowserStack drops the port and the query string from URLs that are redirected this way. I have filed a support request with BrowserStack to discuss this issue.
Problem
It is possible to specify a per-browser URL when configuration BrowserStack browsers in Karma. For example, I might configure a real iOS device like this:
{
base: 'BrowserStack',
os: 'iOS',
os_version: '12',
device: 'iPhone 8',
browser: 'iPhone',
real_mobile: 'true',
// BrowserStack seems to drop the port when redirecting to this special
// domain so we go there directly instead:
url: 'http://bs-local.com:9876'
}
Unfortunately, when configuring browsers this way, the browser ID provided by Karma is overwritten during this Object.assign call, where args contains our original browser configuration:
https://github.com/karma-runner/karma-browserstack-launcher/blob/76dbfd0db6db46f4f85012cfe3c1f4c3accd2e44/index.js#L143-L150
Request
Despite what BrowserStack is doing (which seems like a bug on their side), it seems as though the browser id should be appended after this Object.assign call so that a custom URL can be safely provided (such as in our example above).
I would be willing to submit a pull request for consideration if you find this request agreeable.