<commit_before>'use strict';
var assert = require('assert');
var hasAnsi = require('./');

it('should check if a string has ANSI escape codes', function () {
	assert(hasAnsi('foo\u001b[4mcake\u001b[0m'));
	assert(!hasAnsi('cake'));
});
<commit_msg>Adds a test for the cli<commit_after>'use strict';
var assert = require('assert');
var childProcess = require('child_process');
var hasAnsi = require('./');

it('should check if a string has ANSI escape codes', function () {
	assert(hasAnsi('foo\u001b[4mcake\u001b[0m'));
	assert(!hasAnsi('cake'));
});

describe('the cli', function () {

	it('should exit with 0 if called with stdin containing ANSI escape codes', function (done) {
		var cli = childProcess.exec('echo -e "foo\u001b[4mcake\u001b[0m" | ./cli.js');
		cli.on('exit', function (code) {
			assert(code === 0);
			done()
		});
	});

	it('should exit with 1 if called with stdin containing ANSI escape codes', function (done) {
		var cli = childProcess.exec('echo -e "boring plain old string" | ./cli.js');
		cli.on('exit', function (code) {
			assert(code === 1);
			done()
		});
	});
});

{'fraction_non_alphanumeric': 0.18579234972677597, 'fraction_numerical': 0.025500910746812388, 'mean_word_length': 4.664948453608248, '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': '7066809', 'n_tokens_mistral': 410, 'n_tokens_neox': 374, 'n_words': 106}