<commit_before>'use strict';
const stripAnsi = require('strip-ansi');
const log = require('fancy-log');
const sinon = require('sinon');
const sandbox = sinon.sandbox.create();

beforeEach(() => {
	sandbox.stub(log, 'warn');
});

afterEach(() => {
	sandbox.restore();
});

function errorHandle (error) {
	log(error);
	if (!process.exitCode) {
		process.exitCode = 1;
	}
}

process.on('unhandledRejection', errorHandle);
process.on('uncaughtException', errorHandle);

exports.getLog = () => (
	stripAnsi(
		/* eslint-disable-next-line no-control-regex */
		log.warn.lastCall.args[0].replace(/\u001b]50;\w+=.+?\u0007/, '').replace(/([\u2000-\u3000])\ufe0f?\s+/g, '$1\u{fe0f} ')
	)
		.replace(/\n +\(/g, ' (')
		.replace(/ +/g, ' ')
);
<commit_msg>`sandbox.create()` is deprecated. Use default sandbox at `sinon.sandbox` or create new sandboxes with `sinon.createSandbox()` (#233)<commit_after>'use strict';
const stripAnsi = require('strip-ansi');
const log = require('fancy-log');
const sinon = require('sinon');
const sandbox = sinon.createSandbox();

beforeEach(() => {
	sandbox.stub(log, 'warn');
});

afterEach(() => {
	sandbox.restore();
});

function errorHandle (error) {
	log(error);
	if (!process.exitCode) {
		process.exitCode = 1;
	}
}

process.on('unhandledRejection', errorHandle);
process.on('uncaughtException', errorHandle);

exports.getLog = () => (
	stripAnsi(
		/* eslint-disable-next-line no-control-regex */
		log.warn.lastCall.args[0].replace(/\u001b]50;\w+=.+?\u0007/, '').replace(/([\u2000-\u3000])\ufe0f?\s+/g, '$1\u{fe0f} ')
	)
		.replace(/\n +\(/g, ' (')
		.replace(/ +/g, ' ')
);

{'fraction_non_alphanumeric': 0.2328767123287671, 'fraction_numerical': 0.029265255292652552, 'mean_word_length': 4.5034246575342465, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '570655', 'n_tokens_mistral': 668, 'n_tokens_neox': 612, 'n_words': 98}