<commit_before>/* eslint-disable no-console, node/no-unsupported-features */

var execa = require('execa');

function run(command, args = []) {
  console.log('Running: ' + command + ' ' + args.join(' '));

  let p = execa(command, args);
  p.stdout.pipe(process.stdout);
  p.stderr.pipe(process.stderr);

  return p;
}

(async function() {
  await run('ember', ['browserstack:connect']);

  try {
    try {
      // Calling testem directly here instead of `ember test` so that
      // we do not have to do a double build (by the time this is run
      // we have already ran `ember build`).
      await run('testem', ['ci', '-f', 'testem.dist.js', '--host', '127.0.0.1', '--port', '7774']);

      console.log('success');
      process.exit(0);
    } finally {
      if (process.env.TRAVIS_JOB_NUMBER) {
        await run('ember', ['browserstack:results']);
      }
      await run('ember', ['browserstack:disconnect']);
    }
  } catch (error) {
    console.log('error');
    console.log(error);
    process.exit(1);
  }
})();
<commit_msg>bin/run-browserstack-tests: Use `chalk` for colored console output<commit_after>/* eslint-disable no-console, node/no-unsupported-features */

var execa = require('execa');
var chalk = require('chalk');

function run(command, args = []) {
  console.log(chalk.dim('$ ' + command + ' ' + args.join(' ')));

  let p = execa(command, args);
  p.stdout.pipe(process.stdout);
  p.stderr.pipe(process.stderr);

  return p;
}

(async function() {
  await run('ember', ['browserstack:connect']);

  try {
    try {
      // Calling testem directly here instead of `ember test` so that
      // we do not have to do a double build (by the time this is run
      // we have already ran `ember build`).
      await run('testem', ['ci', '-f', 'testem.dist.js', '--host', '127.0.0.1', '--port', '7774']);

      console.log('success');
      process.exit(0);
    } finally {
      if (process.env.TRAVIS_JOB_NUMBER) {
        await run('ember', ['browserstack:results']);
      }
      await run('ember', ['browserstack:disconnect']);
    }
  } catch (error) {
    console.log('error');
    console.log(error);
    process.exit(1);
  }
})();

{'fraction_non_alphanumeric': 0.18672199170124482, 'fraction_numerical': 0.011065006915629323, 'mean_word_length': 3.011090573012939, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5660789', 'n_tokens_mistral': 734, 'n_tokens_neox': 724, 'n_words': 177}