Exemplo n.º 1
0
// karma tests
//     These tests run in the browser and are allowed to access
//     HTML DOM APIs.
function getBrowsersFromCLI() {
  var isSauce = false;
  var args = minimist(process.argv.slice(2));
  var rawInput = args.browsers ? args.browsers : 'DartiumWithWebPlatform';
  var inputList = rawInput.replace(' ', '').split(',');
  var outputList = [];
  for (var i = 0; i < inputList.length; i++) {
    var input = inputList[i];
    var karmaChromeLauncher = require('karma-chrome-launcher');
    if (sauceConf.customLaunchers.hasOwnProperty(input) || karmaChromeLauncher.hasOwnProperty("launcher:" + input)) {
      // In case of non-sauce browsers, or browsers defined in karma-chrome-launcher (Chrome, ChromeCanary and Dartium):
      // overrides everything, ignoring other options
      outputList = [input];
      isSauce = false;
      break;
    } else if (sauceConf.customLaunchers.hasOwnProperty("SL_" + input.toUpperCase())) {
      isSauce = true;
      outputList.push("SL_" + input.toUpperCase());
    } else if (sauceConf.aliases.hasOwnProperty(input.toUpperCase())) {
      outputList = outputList.concat(sauceConf.aliases[input]);
      isSauce = true;
    } else {
      throw new Error('ERROR: unknown browser found in getBrowsersFromCLI()');
    }
  }
  return {
    browsersToRun: outputList.filter(function(item, pos, self) {return self.indexOf(item) == pos;}),
    isSauce: isSauce
  };
}
Exemplo n.º 2
0
// karma tests
//     These tests run in the browser and are allowed to access
//     HTML DOM APIs.
function getBrowsersFromCLI(provider, isDart) {
  var isProvider = false;
  var rawInput =
      cliArgs.browsers ? cliArgs.browsers : (isDart ? 'DartiumWithWebPlatform' : 'Chrome');
  var inputList = rawInput.replace(' ', '').split(',');
  var outputList = [];
  for (var i = 0; i < inputList.length; i++) {
    var input = inputList[i];
    var karmaChromeLauncher = require('karma-chrome-launcher');
    if (browserProvidersConf.customLaunchers.hasOwnProperty(input) ||
        karmaChromeLauncher.hasOwnProperty("launcher:" + input)) {
      // In case of non-sauce browsers, or browsers defined in karma-chrome-launcher (Chrome,
      // ChromeCanary and Dartium):
      // overrides everything, ignoring other options
      outputList = [input];
      isProvider = false;
      break;
    } else if (provider &&
               browserProvidersConf.customLaunchers.hasOwnProperty(provider + "_" +
                                                                   input.toUpperCase())) {
      isProvider = true;
      outputList.push(provider + "_" + input.toUpperCase());
    } else if (provider && provider == 'SL' &&
               browserProvidersConf.sauceAliases.hasOwnProperty(input.toUpperCase())) {
      outputList = outputList.concat(browserProvidersConf.sauceAliases[input.toUpperCase()]);
      isProvider = true;
    } else if (provider && provider == 'BS' &&
               browserProvidersConf.browserstackAliases.hasOwnProperty(input.toUpperCase())) {
      outputList = outputList.concat(browserProvidersConf.browserstackAliases[input.toUpperCase()]);
      isProvider = true;
    } else {
      throw new Error('ERROR: unknown browser found in getBrowsersFromCLI()');
    }
  }
  return {
    browsersToRun:
        outputList.filter(function(item, pos, self) { return self.indexOf(item) == pos; }),
    isProvider: isProvider
  };
}