<commit_before>"use strict";

var cache = {},
    fs = require('fs'),
    path = require('path'),
    vm = require('vm');

module.exports = function (file, mocks, context) {
    var script;
    mocks = mocks || {};
    context = context || {};
    file = path.join(
        path.dirname(module.parent.filename), file);
    if (!cache[file]) {
        cache[file] = fs.readFileSync(file, 'utf8');
        if (module.exports.onload) {
            cache[file] = module.exports.onload(file, cache[file]);
        }
    }
    script = vm.createScript(cache[file], file);
    context.require = function (a) {
        if (mocks[a]) {
            return mocks[a];
        }
        if (a.indexOf('.') === 0) {
            a = path.join(path.dirname(file), a);
        }
        return require(a);
    };
    context.module = context.module || {};
    context.module.exports = {};

    script.runInNewContext(context);
    return context.module.exports;
};

module.exports.onload = function (file, content) {
    if (file && file.match(/\.coffee$/)) {
        return require('coffee-script').compile(content, {
            filename : file
        });
    }
    return content;
};<commit_msg>No need for `file &&` in the `if` since we added the `returnValue` to `beforeEach`<commit_after>"use strict";

var cache = {},
    fs = require('fs'),
    path = require('path'),
    vm = require('vm');

module.exports = function (file, mocks, context) {
    var script;
    mocks = mocks || {};
    context = context || {};
    file = path.join(
        path.dirname(module.parent.filename), file);
    if (!cache[file]) {
        cache[file] = fs.readFileSync(file, 'utf8');
        if (module.exports.onload) {
            cache[file] = module.exports.onload(file, cache[file]);
        }
    }
    script = vm.createScript(cache[file], file);
    context.require = function (a) {
        if (mocks[a]) {
            return mocks[a];
        }
        if (a.indexOf('.') === 0) {
            a = path.join(path.dirname(file), a);
        }
        return require(a);
    };
    context.module = context.module || {};
    context.module.exports = {};

    script.runInNewContext(context);
    return context.module.exports;
};

module.exports.onload = function (file, content) {
    if (file.match(/\.coffee$/)) {
        return require('coffee-script').compile(content, {
            filename : file
        });
    }
    return content;
};
{'fraction_non_alphanumeric': 0.16989690721649484, 'fraction_numerical': 0.0016494845360824743, 'mean_word_length': 2.2739541160593792, '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': '1301252', 'n_tokens_mistral': 759, 'n_tokens_neox': 750, 'n_words': 156}