config/karma/ci-ie.karma.conf.js
function getSpecsRegex() {
  const argv = minimist(process.argv.slice(2));

  /**
   * The command line argument `--ieBatch` is a string representing
   * the current batch to run, of total batches.
   * For example, `npm run test:unit:ci:ie -- --ieBatch 1of3`
   */
  const [
    currentRun,
    totalRuns
  ] = argv.ieBatch.split('of');

  if (!currentRun || !totalRuns) {
    throw 'Invalid IE 11 batch request! Please provide a command line argument in the format of `--ieBatch 1of3`.';
  }

  const moduleDirectories = getDirectories(path.resolve('src/modules'));
  const totalModules = moduleDirectories.length;
  const modulesPerRun = Math.ceil(moduleDirectories.length / totalRuns);
  const startAtIndex = modulesPerRun * (currentRun - 1);
  const modules = moduleDirectories.splice(startAtIndex, modulesPerRun);

  if (modules.length === 0) {
    return;
  }

  console.log(`[Batch ${currentRun} of ${totalRuns}]`);
  console.log(`--> Running specs for ${modules.length} modules...`);
  console.log(`--> Starting at module ${startAtIndex}, ending at module ${startAtIndex + modules.length}, of ${totalModules} total modules\n`);
  console.log(modules.join(',\n'));

  return [
    String.raw`\\/`,
    '\(',
    ...modules.join('|'),
    ')\\/'
  ].join('').replace(/\-/g, '\\-');
}
function getSpecsRegex() {
  const argv = minimist(process.argv.slice(2));

  /**
   * The command line argument `--ieBatch` is a string representing
   * the current batch to run, of total batches.
   * For example, `npm run test:unit:ci:ie -- --ieBatch 1of3`
   */
  const [
    currentRun,
    totalRuns
  ] = argv.ieBatch.split('of');

  if (!currentRun || !totalRuns) {
    throw 'Invalid IE 11 batch request! Please provide a command line argument in the format of `--ieBatch 1of3`.';
  }

  const moduleDirectories = getDirectories(path.resolve('src/modules'));
  const totalModules = moduleDirectories.length;
  const modulesPerRun = Math.ceil(moduleDirectories.length / totalRuns);
  const startAtIndex = modulesPerRun * (currentRun - 1);
  const modules = moduleDirectories.splice(startAtIndex, modulesPerRun);

  if (modules.length === 0) {
    return;
  }

  console.log(`[Batch ${currentRun} of ${totalRuns}]`);
  console.log(`--> Running specs for ${modules.length} modules...`);
  console.log(`--> Starting at module ${startAtIndex}, ending at module ${startAtIndex + modules.length}, of ${totalModules} total modules\n`);
  console.log(modules.join(',\n'));

  return [
    String.raw`\\/`,
    '\(',
    ...modules.join('|'),
    ')\\/'
  ].join('').replace(/\-/g, '\\-');
}
function getSpecsRegex ( ) { const argv = minimist ( process . argv . slice ( 2 ) ) ; /**
   * The command line argument `--ieBatch` is a string representing
   * the current batch to run, of total batches.
   * For example, `npm run test:unit:ci:ie -- --ieBatch 1of3`
   */ const [ currentRun , totalRuns ] = argv . ieBatch . split ( 'of' ) ; if ( ! currentRun || ! totalRuns ) { throw 'Invalid IE 11 batch request! Please provide a command line argument in the format of `--ieBatch 1of3`.' ; } const moduleDirectories = getDirectories ( path . resolve ( 'src/modules' ) ) ; const totalModules = moduleDirectories . length ; const modulesPerRun = Math . ceil ( moduleDirectories . length / totalRuns ) ; const startAtIndex = modulesPerRun * ( currentRun - 1 ) ; const modules = moduleDirectories . splice ( startAtIndex , modulesPerRun ) ; if ( modules . length === 0 ) { return ; } console . log ( ` ${ currentRun } ${ totalRuns } ` ) ; console . log ( ` ${ modules . length } ` ) ; console . log ( ` ${ startAtIndex } ${ startAtIndex + modules . length } ${ totalModules } \n ` ) ; console . log ( modules . join ( ',\n' ) ) ; return [ String . raw ` \\ ` , '\(' , ... modules . join ( '|' ) , ')\\/' ] . join ( '' ) . replace ( / \- / g , '\\-' ) ; }
Run only a few modules' specs
Run only a few modules specs