<commit_before>'use strict';

const E = require('events');
const test = require('tape').test;
const reporter = require('../lib/reporter');

class Emit extends E {
	constructor(t) {
		super();
		this.ok = t.ok;
	}

	on(e) {
		this.ok(true, `listens to the '${e}' event`);
		return this;
	}
}

test('fly.reporter', t => {
	const all = [
		'fly_run',
		'flyfile_not_found',
		'fly_watch',
		'fly_watch_event',
		'plugin_load',
		'plugin_error',
		'tasks_force_object',
		'task_error',
		'task_start',
		'task_complete',
		'task_not_found'
	];

	t.plan(all.length + 1);

	const ctx = new Emit(t);
	const rep = reporter.call(ctx);

	t.deepEqual(rep, ctx, 'returns the bound object');

	all.forEach(e => ctx.emit(e));
});

// test('✈  timeInfo', function (t) {
//   var timeInfo = require('../src/reporter/timeInfo').default
//   t.deepEqual(timeInfo(100), { duration: 100, scale: 'ms' },
//     'use `ms` units by default.')
//   t.deepEqual(timeInfo(1000), { duration: 1, scale: 's' },
//     'convert long units to seconds.')
//   t.end()
// })<commit_msg>add reporter test: ensure mock is useful<commit_after>'use strict';

const E = require('events');
const test = require('tape').test;
const reporter = require('../lib/reporter');

class Emit extends E {
	constructor(t) {
		super();
		this.ok = t.ok;
	}

	on(e) {
		this.ok(true, `listens to the '${e}' event`);
		return this;
	}
}

test('fly.reporter', t => {
	const all = [
		'fake_event',
		'fly_run',
		'flyfile_not_found',
		'fly_watch',
		'fly_watch_event',
		'plugin_load',
		'plugin_error',
		'tasks_force_object',
		'task_error',
		'task_start',
		'task_complete',
		'task_not_found'
	];

	t.plan(all.length + 1);

	const ctx = new Emit(t);
	const rep = reporter.call(ctx);

	t.deepEqual(rep, ctx, 'returns the bound object');

	all.forEach(e => ctx.emit(e));

	t.ok(true, 'the `fake_event` was ignored');
});

// test('✈  timeInfo', function (t) {
//   var timeInfo = require('../src/reporter/timeInfo').default
//   t.deepEqual(timeInfo(100), { duration: 100, scale: 'ms' },
//     'use `ms` units by default.')
//   t.deepEqual(timeInfo(1000), { duration: 1, scale: 's' },
//     'convert long units to seconds.')
//   t.end()
// })
{'fraction_non_alphanumeric': 0.2009111617312073, 'fraction_numerical': 0.010933940774487472, 'mean_word_length': 3.575, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '868593', 'n_tokens_mistral': 901, 'n_tokens_neox': 840, 'n_words': 188}