<commit_before>var buster = buster || {};

if (typeof require != "undefined") {
    buster = require("buster-core");
    buster.eventEmitter = require("buster-event-emitter");
    buster.promise = require("buster-promise");
}

(function (B) {
    var thenable = buster.promise.thenable;
    var sequential = buster.promise.sequential;

    function processAll(opt, method, items) {
        var i = 0, args = Array.prototype.slice.call(arguments, 3);
        var runner = this;
        items = items || [];

        return sequential({
            shift: function () {
                var item = items[i++];

                if (item) {
                    return function () {
                        return runner[method].apply(runner, [item].concat(args));
                    };
                } else {
                    return null;
                }
            }
        }, opt);
    }

    function all() {
        var args = Array.prototype.slice.call(arguments);
        return processAll.apply(this, [{ error: function () {} }].concat(args));
    }

    function noisyAll() {
        var args = Array.prototype.slice.call(arguments);
        return processAll.apply(this, [null].concat(args));
    }

    function asyncFunction(func, thisObj) {
        var promise, arg;

        if (func.length == 1) {
            promise = buster.promise.create();

            arg = function (err) {
                try {
                    if (err) {
                        promise.reject(err);
                    } else {
                        promise.resolve();
                    }
                } catch (e) {}
            };
        }

        return func.call(thisObj, arg) || promise;
    }

    function getAll(context, getter, appendMethod) {
        var funcs = [];

        while (context) {
            if (typeof context[getter] == "function") {
                funcs[appendMethod](context[getter]);
            }

            context = context.parent;
        }

        return funcs;
    }

    function getResults(runner) {
        if (!runner.results) {
            runner.results = {
                contexts: 0,
                tests: 0,
                errors: 0,
                failures: 0,
                assertions: 0,
                timeouts: 0,
                deferred: 0
            };
        }

        return runner.results;
    }

    function fireOnCreate(instance, runner) {
        var callbacks = instance.callbacks || [];

        for (var i = 0, l = callbacks.length; i < l; ++i) {
            callbacks[i](runner);
        }
    }

    var exceptionListener = {};
    var windowListener;

    function uncaughtListener(err) {
        if (typeof exceptionListener.listener == "function") {
            exceptionListener.listener(err);
        }
    }

    function catchUncaughtExceptions(listener) {
        if (typeof process != "undefined" && !exceptionListener.listener) {
            process.on("uncaughtException", uncaughtListener);
        }

        if (typeof window != "undefined" && !exceptionListener.listener) {
            windowListener = window.onerror;
            window.onerror = uncaughtListener;
        }

        exceptionListener.listener = listener;
    }

    function releaseUncaughtExceptions() {
        if (typeof process != "undefined") {
            process.removeListener("uncaughtException", uncaughtListener);
        }

        if (typeof window != "undefined") {
            window.onerror = windowListener;
        }

        delete exceptionListener.listener;
    }

    B.testRunner = B.extend(B.create(B.eventEmitter), {
        failOnNoAssertions: true,
        timeout: 250,
        handleUncaughtExceptions: true,

        create: function (opt) {
            opt = opt || {};
            var runner = buster.create(this);

            if (typeof opt.timeout == "number") {
                runner.timeout = opt.timeout;<commit_msg>Browsers only give us the error message, not the exception object<commit_after>var buster = buster || {};

if (typeof require != "undefined") {
    buster = require("buster-core");
    buster.eventEmitter = require("buster-event-emitter");
    buster.promise = require("buster-promise");
}

(function (B) {
    var thenable = buster.promise.thenable;
    var sequential = buster.promise.sequential;

    function processAll(opt, method, items) {
        var i = 0, args = Array.prototype.slice.call(arguments, 3);
        var runner = this;
        items = items || [];

        return sequential({
            shift: function () {
                var item = items[i++];

                if (item) {
                    return function () {
                        return runner[method].apply(runner, [item].concat(args));
                    };
                } else {
                    return null;
                }
            }
        }, opt);
    }

    function all() {
        var args = Array.prototype.slice.call(arguments);
        return processAll.apply(this, [{ error: function () {} }].concat(args));
    }

    function noisyAll() {
        var args = Array.prototype.slice.call(arguments);
        return processAll.apply(this, [null].concat(args));
    }

    function asyncFunction(func, thisObj) {
        var promise, arg;

        if (func.length == 1) {
            promise = buster.promise.create();

            arg = function (err) {
                try {
                    if (err) {
                        promise.reject(err);
                    } else {
                        promise.resolve();
                    }
                } catch (e) {}
            };
        }

        return func.call(thisObj, arg) || promise;
    }

    function getAll(context, getter, appendMethod) {
        var funcs = [];

        while (context) {
            if (typeof context[getter] == "function") {
                funcs[appendMethod](context[getter]);
            }

            context = context.parent;
        }

        return funcs;
    }

    function getResults(runner) {
        if (!runner.results) {
            runner.results = {
                contexts: 0,
                tests: 0,
                errors: 0,
                failures: 0,
                assertions: 0,
                timeouts: 0,
                deferred: 0
            };
        }

        return runner.results;
    }

    function fireOnCreate(instance, runner) {
        var callbacks = instance.callbacks || [];

        for (var i = 0, l = callbacks.length; i < l; ++i) {
            callbacks[i](runner);
        }
    }

    var exceptionListener = {};
    var windowListener;

    function uncaughtListener(err) {
        if (typeof exceptionListener.listener == "function") {
            exceptionListener.listener(err);
        }
    }

    function catchUncaughtExceptions(listener) {
        if (typeof process != "undefined" && !exceptionListener.listener) {
            process.on("uncaughtException", uncaughtListener);
        }

        if (typeof window != "undefined" && !exceptionListener.listener) {
            windowListener = window.onerror;
            window.onerror = function (message) {
                uncaughtListener({ name: "UncaughtError", message: message });
            };
        }

        exceptionListener.listener = listener;
    }

    function releaseUncaughtExceptions() {
        if (typeof process != "undefined") {
            process.removeListener("uncaughtException", uncaughtListener);
        }

        if (typeof window != "undefined") {
            window.onerror = windowListener;
        }

        delete exceptionListener.listener;
    }

    B.testRunner = B.extend(B.create(B.eventEmitter), {
        failOnNoAssertions: true,
        timeout: 250,
        handleUncaughtExceptions: true,

        create: function (opt) {
            opt = opt || {};
            var runner = buster.create(this);

            if (typeof opt.timeout == "number") {
                runner.timeout = opt.timeout;
{'fraction_non_alphanumeric': 0.11591846942603476, 'fraction_numerical': 0.0035013129923721397, 'mean_word_length': 1.58, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4601317', 'n_tokens_mistral': 2177, 'n_tokens_neox': 2046, 'n_words': 457}