<commit_before>#!/usr/bin/env node

var usage = '\
usage: node help.js\n\
\n\
  Emits a usage message and exits successfully.\n\n\
';

var spawn = require('child_process').spawn, path = require('path');

require('proof')(2, function (step, equal, callback) {
  var help = spawn('node', [ path.join(__dirname, 'help.js') ]),
      callback = step();

  var data = '';
  help.stdout.setEncoding('utf8');
  help.stdout.on('data', function (chunk) { data += chunk });
  help.on('close', function (code) {
    equal(data, usage, 'usage');
    equal(code, 0, 'exit success');
    callback();
  });
});<commit_msg>Fix `exit` vs. `close` error in `help.t.js`.<commit_after>#!/usr/bin/env node

var usage = '\
usage: node help.js\n\
\n\
  Emits a usage message and exits successfully.\n\n\
';

var spawn = require('child_process').spawn, path = require('path');

require('proof')(2, function (step, equal, callback) {
  var help = spawn('node', [ path.join(__dirname, 'help.js') ]),
      callback = step();

  var data = '';
  help.stdout.setEncoding('utf8');
  help.stdout.on('data', function (chunk) { data += chunk });
  help.on((/^v0.(\d+)/.exec(process.version) || [])[1] < 8 ? 'exit' : 'close', function (code) {
    equal(data, usage, 'usage');
    equal(code, 0, 'exit success');
    callback();
  });
});
{'fraction_non_alphanumeric': 0.2153256704980843, 'fraction_numerical': 0.006896551724137931, 'mean_word_length': 3.749090909090909, 'pattern_counts': {'":': 0, '<': 4, '<?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': '2922617', 'n_tokens_mistral': 461, 'n_tokens_neox': 451, 'n_words': 112}