<commit_before>'use strict';

if (Neft.utils.isNode) {
    require('lib/module-cache').registerCoffeeScript();
}

Neft.utils.merge(global, require('lib/testing'));
global.assert = Neft.assert;

module.exports = function (runApp) {
    global.app = runApp();
    if (app != null) {
        global.environment = global.app.config.environment;
    }
    require('build/tests');<commit_msg>Support for init.js in testing<commit_after>'use strict';

if (Neft.utils.isNode) {
    require('lib/module-cache').registerCoffeeScript();
}

Neft.utils.merge(global, require('lib/testing'));
global.assert = Neft.assert;

module.exports = function (runApp) {
    let initFunc;
    try {
        initFunc = require('init.js');
    } catch (error) {
        if (!Neft.utils.has(error.message, 'Cannot find module')) {
            throw error;
        }
    }

    global.app = initFunc ? initFunc(runApp) : runApp();

    if (app != null) {
        global.environment = global.app.config.environment;
    }

    require('build/tests');
    return global.app;
{'fraction_non_alphanumeric': 0.15819750719079578, 'fraction_numerical': 0.0, 'mean_word_length': 3.1593625498007967, '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': '2199571', 'n_tokens_mistral': 336, 'n_tokens_neox': 330, 'n_words': 62}