<commit_before>/*
  Shamelessly copied from https://github.com/mochajs/mocha/blob/master/lib/reporters/spec.js
*/

var fs = require('fs');
var sfx = require('sfx');

var Base = require('mocha/lib/reporters/base');
var inherits = require('mocha/lib/utils').inherits;
var color = Base.color;
var cursor = Base.cursor;

var trumpet = fs.readFileSync(__dirname + '/trumpet.txt', 'utf-8');
var microwave = fs.readFileSync(__dirname + '/microwave.txt', 'utf-8');

/**
 * Expose `Spec` w/ a trumpet.
 */

exports = module.exports = Trumpet;

/**
 * Initialize a new `Spec` test reporter.
 *
 * @api public
 * @param {Runner} runner
 */
function Trumpet(runner) {
  Base.call(this, runner);

  var self = this;
  var indents = 0;
  var n = 0;

  function indent() {
    return Array(indents).join('  ');
  }

  runner.on('start', function() {
    console.log();
  });

  runner.on('suite', function(suite) {
    ++indents;
    console.log(color('suite', '%s%s'), indent(), suite.title);
  });

  runner.on('suite end', function() {
    --indents;
    if (indents === 1) {
      console.log();
    }
    !this.stats.failures ? sfx.play(__dirname + '/success.m4a') : null;
  });

  runner.on('pending', function(test) {
    var fmt = indent() + color('pending', '  - %s');
    console.log(fmt, test.title);
  });

  runner.on('pass', function(test) {
    var fmt;
    if (test.speed === 'fast') {
      fmt = indent()
        + color('checkmark', '  ' + Base.symbols.ok)
        + color('pass', ' %s');
      cursor.CR();
      console.log(fmt, test.title);
    } else {
      fmt = indent()
        + color('checkmark', '  ' + Base.symbols.ok)
        + color('pass', ' %s')
        + color(test.speed, ' (%dms)');
      cursor.CR();
      console.log(fmt, test.title, test.duration);
    }
  });

  runner.on('fail', function(test) {
    cursor.CR();
    sfx.play(__dirname + '/sound.m4a');
    console.log(indent() + color('fail', '  %d) %s'), ++n, test.title);
  });

  runner.on('end', function() {
    this.stats.failures ? console.log(trumpet) : console.log(microwave);
    this.epilogue();
  }.bind(self));
}

/**<commit_msg>Decreasing volume of the trumpet<commit_after>/*
  Shamelessly copied from https://github.com/mochajs/mocha/blob/master/lib/reporters/spec.js
*/

var fs = require('fs');
var sfx = require('sfx');

var Base = require('mocha/lib/reporters/base');
var inherits = require('mocha/lib/utils').inherits;
var color = Base.color;
var cursor = Base.cursor;

var trumpet = fs.readFileSync(__dirname + '/trumpet.txt', 'utf-8');
var microwave = fs.readFileSync(__dirname + '/microwave.txt', 'utf-8');

/**
 * Expose `Spec` w/ a trumpet.
 */

exports = module.exports = Trumpet;

/**
 * Initialize a new `Spec` test reporter.
 *
 * @api public
 * @param {Runner} runner
 */
function Trumpet(runner) {
  Base.call(this, runner);

  var self = this;
  var indents = 0;
  var n = 0;

  function indent() {
    return Array(indents).join('  ');
  }

  runner.on('start', function() {
    console.log();
  });

  runner.on('suite', function(suite) {
    ++indents;
    console.log(color('suite', '%s%s'), indent(), suite.title);
  });

  runner.on('suite end', function() {
    --indents;
    if (indents === 1) {
      console.log();
    }
    !this.stats.failures ? sfx.play(__dirname + '/success.m4a') : null;
  });

  runner.on('pending', function(test) {
    var fmt = indent() + color('pending', '  - %s');
    console.log(fmt, test.title);
  });

  runner.on('pass', function(test) {
    var fmt;
    if (test.speed === 'fast') {
      fmt = indent()
        + color('checkmark', '  ' + Base.symbols.ok)
        + color('pass', ' %s');
      cursor.CR();
      console.log(fmt, test.title);
    } else {
      fmt = indent()
        + color('checkmark', '  ' + Base.symbols.ok)
        + color('pass', ' %s')
        + color(test.speed, ' (%dms)');
      cursor.CR();
      console.log(fmt, test.title, test.duration);
    }
  });

  runner.on('fail', function(test) {
    cursor.CR();
    sfx.play(__dirname + '/sound.m4a', 20);
    console.log(indent() + color('fail', '  %d) %s'), ++n, test.title);
  });

  runner.on('end', function() {
    this.stats.failures ? console.log(trumpet) : console.log(microwave);
    this.epilogue();
  }.bind(self));
}

/**
{'fraction_non_alphanumeric': 0.20590302178496134, 'fraction_numerical': 0.0037479503396579995, 'mean_word_length': 2.9318600368324126, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, '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': '6549010', 'n_tokens_mistral': 1558, 'n_tokens_neox': 1509, 'n_words': 299}