<commit_before>
require('should');
require('longjohn');

var vm = require('vm');
var when = require('when');
var sequence = require('when/sequence');
var path = require('path');
var packer = require('../../packer');
var fs = require('../../lib/util/fs');

var buildDir = path.resolve(__dirname, 'build');

var Titanium = {
  Platform: {
    architecture: 'fake42'
  },
  API: {
    log: console.log.bind(console),
    info: console.log.bind(console),
    error: console.error.bind(console),
    warn: console.warn.bind(console),
    trace: console.trace.bind(console)
  }
};

before(function () {
  return fs.rimraf(buildDir).then(function () {
    fs.mkdirp(buildDir);
  });
});

describe("Building", function () {

  it("should work", function () {
    return packer.build({
      entry: path.resolve(__dirname, 'module-1')
    })
    .then(function (zip) {
      return zip.writeModule(buildDir);
    });
  });

  it("should create the right zip", function () {
    assertIsFile(path.resolve(buildDir, 'module-1-commonjs-0.1.2.zip'));
  });

});

describe("Resolution", function () {
  var entry = path.resolve(__dirname, 'module-1');
  var packed = path.resolve(buildDir, 'module-1.js');

  it("should work", function () {
    return packer.pack(entry, {
      // no config
    })
    .then(function (src) {
      return fs.writeFile(packed, src);
    });
  });<commit_msg>Better test section name<commit_after>
require('should');
require('longjohn');

var vm = require('vm');
var when = require('when');
var sequence = require('when/sequence');
var path = require('path');
var packer = require('../../packer');
var fs = require('../../lib/util/fs');

var buildDir = path.resolve(__dirname, 'build');

var Titanium = {
  Platform: {
    architecture: 'fake42'
  },
  API: {
    log: console.log.bind(console),
    info: console.log.bind(console),
    error: console.error.bind(console),
    warn: console.warn.bind(console),
    trace: console.trace.bind(console)
  }
};

before(function () {
  return fs.rimraf(buildDir).then(function () {
    fs.mkdirp(buildDir);
  });
});

describe("Building", function () {

  it("should work", function () {
    return packer.build({
      entry: path.resolve(__dirname, 'module-1')
    })
    .then(function (zip) {
      return zip.writeModule(buildDir);
    });
  });

  it("should create the right zip", function () {
    assertIsFile(path.resolve(buildDir, 'module-1-commonjs-0.1.2.zip'));
  });

});

describe("Bundling", function () {
  var entry = path.resolve(__dirname, 'module-1');
  var packed = path.resolve(buildDir, 'module-1.js');

  it("should work", function () {
    return packer.pack(entry, {
      // no config
    })
    .then(function (src) {
      return fs.writeFile(packed, src);
    });
  });
{'fraction_non_alphanumeric': 0.19109663409337677, 'fraction_numerical': 0.006514657980456026, 'mean_word_length': 3.4437299035369775, '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': '7421099', 'n_tokens_mistral': 918, 'n_tokens_neox': 898, 'n_words': 181}