<commit_before>var os = require('os'),
	fs = require('fs'),
	path = require('path'),
	assert = require('assert'),
	swintHelper = require('swint-helper'),
	buildJS = require('../lib');

global.swintVar.printLevel = 5;

describe('builder-js', function() {
	it('Error when no callback', function() {
		assert.throws(function() {
			buildJS({});
		});
	});

	it('Error when inDir doesn\'t exist', function(done) {
		buildJS({
			inDir: '/this-directory-does-not-exist'
		}, function(err, res) {
			assert.notEqual(err, null);
			done();
		});
	});

	it('Common case', function(done) {
		buildJS({
			name: 'Test',
			inDir: path.join(__dirname, '../test_case'),
			outDir: path.join(os.tmpdir(), 'swint-builder-js-out'),
			minify: true,
			variables: {
				tmplVar: 'A'
			}
		}, function(err, res) {
			assert.deepEqual(
				fs.readFileSync(path.join(os.tmpdir(), 'swint-builder-js-out/Test.js'), 'utf-8'),
				fs.readFileSync(path.join(__dirname, '../test_result/common.js'), 'utf-8')
			);

			assert.deepEqual(
				fs.readFileSync(path.join(os.tmpdir(), 'swint-builder-js-out/Test.min.js'), 'utf-8'),
				fs.readFileSync(path.join(__dirname, '../test_result/common.min.js'), 'utf-8')
			);

			assert.deepEqual(
				fs.readFileSync(path.join(os.tmpdir(), 'swint-builder-js-out/Test.min.js.map'), 'utf-8'),
				fs.readFileSync(path.join(__dirname, '../test_result/common.min.js.map'), 'utf-8')
			);

			done();
		});
	});

	after(function() {
		fs.unlinkSync(path.join(os.tmpdir(), 'swint-builder-js-out/Test.js'));
		fs.unlinkSync(path.join(os.tmpdir(), 'swint-builder-js-out/Test.min.js'));
		fs.unlinkSync(path.join(os.tmpdir(), 'swint-builder-js-out/Test.min.js.map'));
		fs.rmdirSync(path.join(os.tmpdir(), 'swint-builder-js-out'));<commit_msg>Changed test format<commit_after>var os = require('os'),
	fs = require('fs'),
	path = require('path'),
	assert = require('assert'),
	swintHelper = require('swint-helper'),
	buildJS = require('../lib');

global.swintVar.printLevel = 5;

describe('builder-js', function() {
	it('Error when no callback', function() {
		assert.throws(function() {
			buildJS({});
		});
	});

	it('Error when inDir doesn\'t exist', function(done) {
		buildJS({
			inDir: '/this-directory-does-not-exist'
		}, function(err, res) {
			assert.notEqual(err, null);
			done();
		});
	});

	it('Common case', function(done) {
		buildJS({
			name: 'Test',
			inDir: path.join(__dirname, '../test_case'),
			outDir: path.join(os.tmpdir(), 'swint-builder-js-out'),
			minify: true,
			variables: {
				tmplVar: 'A'
			}
		}, function(err, res) {
			assert.deepEqual(
				fs.readFileSync(path.join(os.tmpdir(), 'swint-builder-js-out/Test.js'), 'utf-8'),
				fs.readFileSync(path.join(__dirname, '../test_result/common.js'), 'utf-8')
			);

			assert.deepEqual(
				fs.readFileSync(path.join(os.tmpdir(), 'swint-builder-js-out/Test.min.js'), 'utf-8'),
				fs.readFileSync(path.join(__dirname, '../test_result/common.min.js'), 'utf-8')
			);

			assert.deepEqual(
				JSON.parse(fs.readFileSync(path.join(os.tmpdir(), 'swint-builder-js-out/Test.min.js.map'), 'utf-8')),
				JSON.parse(fs.readFileSync(path.join(__dirname, '../test_result/common.min.js.map'), 'utf-8'))
			);

			done();
		});
	});

	after(function() {
		fs.unlinkSync(path.join(os.tmpdir(), 'swint-builder-js-out/Test.js'));
		fs.unlinkSync(path.join(os.tmpdir(), 'swint-builder-js-out/Test.min.js'));
		fs.unlinkSync(path.join(os.tmpdir(), 'swint-builder-js-out/Test.min.js.map'));
		fs.rmdirSync(path.join(os.tmpdir(), 'swint-builder-js-out'));
{'fraction_non_alphanumeric': 0.22436260623229462, 'fraction_numerical': 0.00396600566572238, 'mean_word_length': 3.9384615384615387, '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': '1145596', 'n_tokens_mistral': 1490, 'n_tokens_neox': 1339, 'n_words': 177}