<commit_before>var Mocha = require('mocha');
var path = require('path');
var glob = require('glob');
var format = require('util').format;
var debug = require('debug')('mj:command:ci:run');

/**
 * @todo (imlucas) If `fs.exists(process.cwd(), '/.zuul.yml')`, exec
 * zuul w/ --electron + mocha opts above.
 * @todo (imlucas) Istanbul is kind of beefy and hard to use
 * programmatically... Switch to blanket.
 * http://www.asyncdev.net/2013/07/javascript-test-coverage-with-blanket-js/
  * @todo (imlucas): Grab latest api usage from [bin/_mocha] as
  * the wiki page is pretty out of date.
  *
  * [bin/_mocha]: https://github.com/mochajs/mocha/blob/master/bin/_mocha
  */
module.exports = function(argv, done) {
  var options = {
    ui: 'bdd',
    reporter: 'mocha-evergreen-reporter'
  };

  debug('mocha options', options);

  var mocha = new Mocha(options);
  mocha.useInlineDiffs(true)

  var testDir = path.join(argv.directory, 'test');
  debug('collecting tests from `%s`', testDir + '/*.test.js');

  glob('*.test.js', {cwd: testDir}, function(err, files) {
    if (err) {
      done(err);
      return;
    }
    if (files.length === 0) {
      done(new Error('No .test.js files found under ' + testDir));
      return;
    }

    files.map(function(file) {
      debug('adding `%s` to test suite', file);
      mocha.addFile(path.join(testDir, file));
    });
    argv.spinner('Running tests');
    // Run the tests.
    try{
      mocha.run(function(failures) {
        argv.ci.failed = failures > 0;<commit_msg>:bug: try requiring evergreen mocha reporter<commit_after>var Mocha = require('mocha');
var path = require('path');
var glob = require('glob');
var format = require('util').format;
var debug = require('debug')('mj:command:ci:run');

/**
 * @todo (imlucas) If `fs.exists(process.cwd(), '/.zuul.yml')`, exec
 * zuul w/ --electron + mocha opts above.
 * @todo (imlucas) Istanbul is kind of beefy and hard to use
 * programmatically... Switch to blanket.
 * http://www.asyncdev.net/2013/07/javascript-test-coverage-with-blanket-js/
  * @todo (imlucas): Grab latest api usage from [bin/_mocha] as
  * the wiki page is pretty out of date.
  *
  * [bin/_mocha]: https://github.com/mochajs/mocha/blob/master/bin/_mocha
  */
module.exports = function(argv, done) {
  var options = {
    ui: 'bdd',
    reporter: require('mocha-evergreen-reporter')
  };

  debug('mocha options', options);

  var mocha = new Mocha(options);
  mocha.useInlineDiffs(true)

  var testDir = path.join(argv.directory, 'test');
  debug('collecting tests from `%s`', testDir + '/*.test.js');

  glob('*.test.js', {cwd: testDir}, function(err, files) {
    if (err) {
      done(err);
      return;
    }
    if (files.length === 0) {
      done(new Error('No .test.js files found under ' + testDir));
      return;
    }

    files.map(function(file) {
      debug('adding `%s` to test suite', file);
      mocha.addFile(path.join(testDir, file));
    });
    argv.spinner('Running tests');
    // Run the tests.
    try{
      mocha.run(function(failures) {
        argv.ci.failed = failures > 0;
{'fraction_non_alphanumeric': 0.17292746113989638, 'fraction_numerical': 0.0051813471502590676, 'mean_word_length': 3.2315068493150685, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, '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': '2934907', 'n_tokens_mistral': 1124, 'n_tokens_neox': 1066, 'n_words': 260}