<commit_before>/*global describe, it */

/**
 *
 */
var expect = require('expect.js');

describe('mustang', function() {
  var fs = require('fs');
  var path = require('path');

  var Mustang = require('../lib/mustang');

  var templateDir = path.join(__dirname, 'fixtures/template');
  var inputDir = path.join(__dirname, 'fixtures/input');
  var outputDir = path.join(__dirname, 'fixtures/output');
  var tmpDir = path.join(__dirname, '__tmp__');

  try {
    fs.mkdirSync(tmpDir);
  } catch(e) {}

  /**
   *
   */
  it('should initialize', function() {
    var mustang = new Mustang({});
  });

  /**
   *
   */
  it('should accept CSV file', function(done) {
    var config = {
      template: path.join(templateDir, '01.html'),
      input: path.join(inputDir, '01.csv'),
      output: path.join(tmpDir, '01.html')
    };
    var mustang = new Mustang(config);
    mustang.on('end', function() {
      var output = fs.readFileSync(config.output, 'utf-8');
      var expected = fs.readFileSync(path.join(outputDir, '01.html'), 'utf-8');
      expect(output).to.be(expected);
      done();
    });
    mustang.on('error', function(err) {
      expect().fail();
    });
    mustang.render();
  });

  /**
   *
   */
  it('should accept JSON file', function(done) {
    var config = {
      template: path.join(templateDir, '02.html'),
      input: path.join(inputDir, '02.json'),
      output: path.join(tmpDir, '02.html')
    };
    var mustang = new Mustang(config);
    mustang.on('end', function() {
      var output = fs.readFileSync(config.output, 'utf-8');
      var expected = fs.readFileSync(path.join(outputDir, '02.html'), 'utf-8');
      expect(output).to.be(expected);
      done();
    });
    mustang.on('error', function(err) {
      expect().fail();
    });<commit_msg>add stack trace in test error<commit_after>/*global describe, it */

/**
 *
 */
var expect = require('expect.js');

describe('mustang', function() {
  var fs = require('fs');
  var path = require('path');

  var Mustang = require('../lib/mustang');

  var templateDir = path.join(__dirname, 'fixtures/template');
  var inputDir = path.join(__dirname, 'fixtures/input');
  var outputDir = path.join(__dirname, 'fixtures/output');
  var tmpDir = path.join(__dirname, '__tmp__');

  try {
    fs.mkdirSync(tmpDir);
  } catch(e) {}

  /**
   *
   */
  it('should initialize', function() {
    var mustang = new Mustang({});
  });

  /**
   *
   */
  it('should accept CSV file', function(done) {
    var config = {
      template: path.join(templateDir, '01.html'),
      input: path.join(inputDir, '01.csv'),
      output: path.join(tmpDir, '01.html')
    };
    var mustang = new Mustang(config);
    mustang.on('end', function() {
      var output = fs.readFileSync(config.output, 'utf-8');
      var expected = fs.readFileSync(path.join(outputDir, '01.html'), 'utf-8');
      expect(output).to.be(expected);
      done();
    });
    mustang.on('error', function(err) {
      console.error(err.stack);
      expect().fail();
    });
    mustang.render();
  });

  /**
   *
   */
  it('should accept JSON file', function(done) {
    var config = {
      template: path.join(templateDir, '02.html'),
      input: path.join(inputDir, '02.json'),
      output: path.join(tmpDir, '02.html')
    };
    var mustang = new Mustang(config);
    mustang.on('end', function() {
      var output = fs.readFileSync(config.output, 'utf-8');
      var expected = fs.readFileSync(path.join(outputDir, '02.html'), 'utf-8');
      expect(output).to.be(expected);
      done();
    });
    mustang.on('error', function(err) {
      expect().fail();
    });
{'fraction_non_alphanumeric': 0.19222283507997795, 'fraction_numerical': 0.011031439602868174, 'mean_word_length': 2.9466811751904243, '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': '2841718', 'n_tokens_mistral': 1244, 'n_tokens_neox': 1209, 'n_words': 238}