addSauceTests = (cfg, sauceLabs) => {
  if (sauceLabs) {
    const sauceBrowsers = Object.keys(SAUCE_BROWSER_PLATFORM_MAP);

    // creates Karma `customLauncher` configs from `SAUCE_BROWSER_PLATFORM_MAP`
    const customLaunchers = sauceBrowsers.reduce((acc, sauceBrowser) => {
      const platformName = SAUCE_BROWSER_PLATFORM_MAP[sauceBrowser];
      const [browserName, browserVersion] = sauceBrowser.split('@');
      const result = {
        ...acc,
        [sauceBrowser]: {
          base: 'SauceLabs',
          browserName,
          browserVersion,
          platformName,
          'sauce:options': sauceLabs
        }
      };
      if (browserName === 'firefox') {
        result[sauceBrowser]['sauce:options']['moz:debuggerAddress'] = true;
      }
      return result;
    }, {});

    const result = {
      ...cfg,
      reporters: [...cfg.reporters, 'saucelabs'],
      browsers: [...cfg.browsers, ...sauceBrowsers],
      customLaunchers: {
        ...cfg.customLaunchers,
        ...customLaunchers
      },
      sauceLabs,
      concurrency: Infinity,
      retryLimit: 1,
      captureTimeout: 120000,
      browserNoActivityTimeout: 20000
    };
    return result;
  }
  return {...cfg};
}
Adds Saucelabs-specific config to a Karma config object.

If `sauceLabs` parameter is falsy, just return a clone of the `cfg` parameter.

@see https://github.com/karma-runner/karma-sauce-launcher
@see https://github.com/bermi/sauce-connect-launcher#advanced-usage
@param {object} cfg - Karma config
@param {object} [sauceLabs] - SauceLabs config
@returns {object} Karma config