<commit_before>try {
  var args = process.argv, reporter_type = 'default';
  var reporters = require('nodeunit').reporters;

  if (args.length == 3) {
    reporter_type = args[2];

    if (!(reporter_type in reporters)) {
      console.error('Invalid reporter_type specified', reporter_type);
      process.exit();
    }
  }

  var reporter = reporters[reporter_type];
  var options  = require('./nodeunit.json');
}
catch(e) {
  console.log(e);
  console.log('Cannot find nodeunit module.');
  process.exit();
}

process.chdir(__dirname);

process.removeAllListeners('uncaughtException');

try {
  var server = require('mockserver').init();
  server.on('listening', function() {
    reporter.run([
      'src',
      'src/runner',
      'src/assertions',
      'src/commands',
      'src/protocol',
      'src/http',
      'src/index'
    ], options, function(err) {
      setTimeout(function() {
        server.close();
      }, 0);

      if (err) {
        process.exit(1);
      }
    });
  });
} catch (err) {
  console.log(err.stack);
  process.exit(1);
}<commit_msg>updated nodeunit test runner<commit_after>try {
  var args = process.argv, reporter_type = 'default';
  var reporters = require('nodeunit').reporters;

  if (args.length == 3) {
    reporter_type = args[2];

    if (!(reporter_type in reporters)) {
      console.error('Invalid reporter_type specified', reporter_type);
      process.exit();
    }
  }

  var reporter = reporters[reporter_type];
  var options  = require('./nodeunit.json');
}
catch(e) {
  console.log(e);
  console.log('Cannot find nodeunit module.');
  process.exit();
}

process.chdir(__dirname);

process.removeAllListeners('uncaughtException');

try {
  var server = require('mockserver').init();
  server.on('listening', function() {
    reporter.run([
      'src',
      'src/runner',
      'src/assertions',
      'src/commands',
      'src/protocol',
      'src/http',
      'src/index'
    ], options, function(err) {
      setTimeout(function() {
        server.close();
      }, 100);

      if (err) {
        process.exit(1);
      }
    });
  });
} catch (err) {
  console.log(err.stack);
  process.exit(1);
}
{'fraction_non_alphanumeric': 0.16920943134535368, 'fraction_numerical': 0.005547850208044383, 'mean_word_length': 2.920289855072464, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '6770950', 'n_tokens_mistral': 707, 'n_tokens_neox': 701, 'n_words': 131}