<commit_before>const chai           = require('chai');
const Vinyl          = require('vinyl');
const stream         = require('stream');
const chaiAsPromised = require('chai-as-promised');

const lightscript    = require('../');

const expect         = chai.expect;

chai.use(chaiAsPromised);

describe('Main process', () => {

  describe('Full compile', () => {

    it('should process file with no error', (done) => {
      const pair = new Vinyl({ path: '/tmp/test.s', contents: new Buffer(`a = []`)});
      const passStream = new stream.PassThrough({ objectMode: true });

      const outStream = lightscript.transpileStream(passStream);

      outStream.on('data', (file) => {
        expect(file.path).to.eq('/tmp/test.js');
        expect(file.contents.toString()).to.eq(`(function () {
    let a = [];
})();
`);
      });

      outStream.on('error', (err) => {
        done(new Error('Error'));
      });

      outStream.on('end', (err) => {
        done();
      });

      passStream.push(pair);
      passStream.push(null);

    });

    it('should process file with error', (done) => {
      const pair = new Vinyl({ path: '/tmp/test.s', contents: new Buffer(`a: number = 'a'`)});
      const passStream = new stream.PassThrough({ objectMode: true });

      const outStream = lightscript.transpileStream(passStream);

      outStream.on('data', (file) => {
      });

      outStream.on('error', (err) => {
        done();
        done = () => {};
      });

      passStream.push(pair);
      passStream.push(null);

    });

  });<commit_msg>Adjust mocha for travis timeout<commit_after>const chai           = require('chai');
const Vinyl          = require('vinyl');
const stream         = require('stream');
const chaiAsPromised = require('chai-as-promised');

const steel          = require('../');

const expect         = chai.expect;

chai.use(chaiAsPromised);

describe('Main process', () => {

  describe('Full compile', () => {

    it('should process file with no error', (done) => {
      this.timeout(5000);
      const pair = new Vinyl({ path: '/tmp/test.s', contents: new Buffer(`a = []`)});
      const passStream = new stream.PassThrough({ objectMode: true });

      const outStream = steel.transpileStream(passStream);

      outStream.on('data', (file) => {
        expect(file.path).to.eq('/tmp/test.js');
        expect(file.contents.toString()).to.eq(`(function () {
    let a = [];
})();
`);
      });

      outStream.on('error', (err) => {
        done(new Error('Error'));
      });

      outStream.on('end', (err) => {
        done();
      });

      passStream.push(pair);
      passStream.push(null);

    });

    it('should process file with error', (done) => {
      this.timeout(5000);
      const pair = new Vinyl({ path: '/tmp/test.s', contents: new Buffer(`a: number = 'a'`)});
      const passStream = new stream.PassThrough({ objectMode: true });

      const outStream = steel.transpileStream(passStream);

      outStream.on('data', (file) => {
      });

      outStream.on('error', (err) => {
        done();
        done = () => {};
      });

      passStream.push(pair);
      passStream.push(null);

    });

  });
{'fraction_non_alphanumeric': 0.19119496855345913, 'fraction_numerical': 0.0025157232704402514, 'mean_word_length': 2.538375973303671, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, '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': '4770819', 'n_tokens_mistral': 1008, 'n_tokens_neox': 961, 'n_words': 200}