<commit_before>define(['jquery', 'lodash'], function($, _) {
    var testWrapper = function() {
        this.currentTest = '';
        this.startTime = 0;
        this.testQuantity = 0;
        this.testFailed = 0;
        this.testSucceed = 0;
        this.$resultContainer = $('.TestResultsArea');
        this.$testReportContainer = $('.TestReport');
        this.$testQuantity = this.$testReportContainer.find('.tests-quantity');
        this.$testSuceedQuantity =
            this.$testReportContainer.find('.tests-succeed-quantity');
        this.$testFailedQuantity =
            this.$testReportContainer.find('.tests-failed-quantity');

        this.execTest = function(mainName, testName, testFn) {
            var startTime = new Date();
            var succeed = null;
            var errorMsg = null;
            try {
                testFn();
                succeed = true;
            } catch (error) {
                succeed = false;
                errorMsg = error;
            }
            var timeSpent = new Date() - startTime;

            console[succeed ? 'log' : 'error']('Test #' + this.testQuantity
                + ' "' + mainName + ' | ' + testName + '" took ' + timeSpent + 'ms to ' +
                (succeed ? 'SUCCEED' : 'FAILED')
                + '.');

            this.updateCounters(succeed);

            this.renderTest(succeed, mainName, testName, timeSpent, errorMsg);
        }

        this.updateCounters = function(succeed) {
            this.testQuantity++;
            if (succeed) {
                this.testSucceed++;
            } else {
                this.testFailed++;
            }

            this.$testQuantity.text(this.testQuantity);
            this.$testSuceedQuantity.text(this.testSucceed);
            this.$testFailedQuantity.text(this.testFailed);
        }

        this.createTestClass = function(mainName) {
            return 'testBlock-' + _.replace(mainName, ' ', '_');
        }

        this.getTestContainer = function(mainName) {
            var className = this.createTestClass(mainName);
            var $container = this.$resultContainer.find('.' + className);

            if (!$container.length) {
                $container = $('<div>',{
                    class: className,
                });
                $ul = $('<ul>');
                $title = $('<h3>', {
                    text: mainName,
                });
                $container.append($title);
                $container.append($ul);
                this.$resultContainer.append($container);
            }

            return $container.find('ul');
        }

        this.renderTest = function(succeed, mainName, name, time, errorMsg) {
            var $container = this.getTestContainer(mainName);
            var $result = $('<li/>', {
                class: 'mdl-list__item',
            });
            var iconName = succeed ? 'done' : 'close';
            var checked = succeed ? 'checked' : '';
            var secondaryBlock = succeed ? `${time} ms` : errorMsg;
            var iconClass = succeed ? 'icon-succeed' : 'icon-failed';
            var $testStatus = $(`
                <span class="mdl-list__item-primary-content">
                    <i class="material-icons mdl-list__item-avatar ${iconClass}">
                        ${iconName}
                    </i>
                    ${name}
                </span>
                <span class="mdl-list__item-secondary-action">
                    ${secondaryBlock}
                </span>`
            );
            $result.append($testStatus);
            $container.append($result);
        }
    };

    return new testWrapper();
});
<commit_msg>All test run in parallele now.<commit_after>define(['jquery', 'lodash'], function($, _) {
    var testWrapper = function() {
        this.currentTest = '';
        this.startTime = 0;
        this.testQuantity = 0;
        this.testFailed = 0;
        this.testSucceed = 0;
        this.$resultContainer = $('.TestResultsArea');
        this.$testReportContainer = $('.TestReport');
        this.$testQuantity = this.$testReportContainer.find('.tests-quantity');
        this.$testSuceedQuantity =
            this.$testReportContainer.find('.tests-succeed-quantity');
        this.$testFailedQuantity =
            this.$testReportContainer.find('.tests-failed-quantity');

        this.execTest = function(mainName, testName, testFn) {
            var myself = this;
            setTimeout(function() {
                var startTime = new Date();
                var succeed = null;
                var errorMsg = null;
                try {
                    testFn();
                    succeed = true;
                } catch (error) {
                    succeed = false;
                    errorMsg = error;
                }
                var timeSpent = new Date() - startTime;

                console[succeed ? 'log' : 'error']('Test #' + this.testQuantity
                    + ' "' + mainName + ' | ' + testName + '" took ' + timeSpent + 'ms to ' +
                    (succeed ? 'SUCCEED' : 'FAILED')
                    + '.');

                myself.updateCounters(succeed);
                myself.renderTest(succeed, mainName, testName, timeSpent, errorMsg);
            }, 0);
        }

        this.updateCounters = function(succeed) {
            this.testQuantity++;
            if (succeed) {
                this.testSucceed++;
            } else {
                this.testFailed++;
            }

            this.$testQuantity.text(this.testQuantity);
            this.$testSuceedQuantity.text(this.testSucceed);
            this.$testFailedQuantity.text(this.testFailed);
        }

        this.createTestClass = function(mainName) {
            return 'testBlock-' + _.replace(mainName, ' ', '_');
        }

        this.getTestContainer = function(mainName) {
            var className = this.createTestClass(mainName);
            var $container = this.$resultContainer.find('.' + className);

            if (!$container.length) {
                $container = $('<div>',{
                    class: className,
                });
                $ul = $('<ul>');
                $title = $('<h3>', {
                    text: mainName,
                });
                $container.append($title);
                $container.append($ul);
                this.$resultContainer.append($container);
            }

            return $container.find('ul');
        }

        this.renderTest = function(succeed, mainName, name, time, errorMsg) {
            var $container = this.getTestContainer(mainName);
            var $result = $('<li/>', {
                class: 'mdl-list__item',
            });
            var iconName = succeed ? 'done' : 'close';
            var checked = succeed ? 'checked' : '';
            var secondaryBlock = succeed ? `${time} ms` : errorMsg;
            var iconClass = succeed ? 'icon-succeed' : 'icon-failed';
            var $testStatus = $(`
                <span class="mdl-list__item-primary-content">
                    <i class="material-icons mdl-list__item-avatar ${iconClass}">
                        ${iconName}
                    </i>
                    ${name}
                </span>
                <span class="mdl-list__item-secondary-action">
                    ${secondaryBlock}
                </span>`
            );
            $result.append($testStatus);
            $container.append($result);
        }
    };

    return new testWrapper();
});

{'fraction_non_alphanumeric': 0.13373173970783533, 'fraction_numerical': 0.0014608233731739709, 'mean_word_length': 1.465946299934512, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '4200350', 'n_tokens_mistral': 2037, 'n_tokens_neox': 1902, 'n_words': 350}