const reporter = require('mocha/lib/reporters').min;
const bridgeTests = require('mocha-selenium-bridge');
const { Builder } = require('selenium-webdriver');

const bsConfig = {
  project: 'messageformat',
  'browserstack.local': 'true',
  'browserstack.user': process.env.BROWSERSTACK_USER,
  'browserstack.key': process.env.BROWSERSTACK_ACCESS_KEY,
  'browserstack.localIdentifier': process.env.BROWSERSTACK_LOCAL_IDENTIFIER
};

const PORT = 3000;
const url = `http://localhost:${PORT}/test/browser/test.html`;

/* eslint-disable camelcase */
exports.testBrowser = async function (browserName, browser_version) {
  const cap = Object.assign({ browserName, browser_version }, bsConfig);
  const driver = new Builder()
    .usingServer('http://hub-cloud.browserstack.com/wd/hub')
    .withCapabilities(cap)
    .build();
  const code = await bridgeTests(driver, reporter, url, { timeout: 20000 });
  driver.quit();
  if (code > 0) throw new Error(`Failed ${code} tests`);
  if (code < 0) throw new Error(`MSB error ${code}`);
};

@@ -249,24 +249,28 @@
 stack.user':
+%0A   
  process.env
@@ -287,16 +287,53 @@
 ACK_USER
+ %7C%7C process.env.BROWSERSTACK_USERNAME
 ,%0A  'bro

Fix env var name for BrowserStack user