<commit_before>var exec = require('child_process').exec;
var test = require('tape').test;
var fixtures = require('./fixtures');
var expected = require('./expected');
var path = require('path');
var queue = require('queue-async');
var _ = require('underscore');
var run = path.resolve(__dirname, '../bin/mapbox-upload-validate.js');

test.only('bin.mapbox-upload-validate: invalid', function(t) {
  function validate(type, filepath, reason, callback) {
    if (!callback) {
      callback = reason;
      reason = undefined;
    }

    exec([run, filepath].join(' '), function(err, stdout, stderr) {
      t.equal(err.code, 3, 'exit 3');
      t.equal(stdout, '', [type, reason].join('.') + ': nothing logged to stdout');
      var expect = expected[type + 'Errors'];
      if (reason) expect = expect[reason];

      t.ok(stderr.indexOf(expect) > -1, [type, reason].join('.') + ': expected error message');
      callback();<commit_msg>ugh, getting sloppy<commit_after>var exec = require('child_process').exec;
var test = require('tape').test;
var fixtures = require('./fixtures');
var expected = require('./expected');
var path = require('path');
var queue = require('queue-async');
var _ = require('underscore');
var run = path.resolve(__dirname, '../bin/mapbox-upload-validate.js');

test('bin.mapbox-upload-validate: invalid', function(t) {
  function validate(type, filepath, reason, callback) {
    if (!callback) {
      callback = reason;
      reason = undefined;
    }

    exec([run, filepath].join(' '), function(err, stdout, stderr) {
      t.equal(err.code, 3, 'exit 3');
      t.equal(stdout, '', [type, reason].join('.') + ': nothing logged to stdout');
      var expect = expected[type + 'Errors'];
      if (reason) expect = expect[reason];

      t.ok(stderr.indexOf(expect) > -1, [type, reason].join('.') + ': expected error message');
      callback();
{'fraction_non_alphanumeric': 0.19006940736785904, 'fraction_numerical': 0.003203416978109984, 'mean_word_length': 3.905759162303665, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2980271', 'n_tokens_mistral': 576, 'n_tokens_neox': 562, 'n_words': 141}