<commit_before>(function (root, factory) {
    'use strict';
    if (typeof define === 'function' && define.amd) {
        define(['empower', 'espower-source', 'assert'], factory);
    } else if (typeof exports === 'object') {
        factory(require('..'), require('espower-source'), require('assert'));
    } else {
        factory(root.empower, root.espowerSource, root.assert);
    }
}(this, function (
    empower,
    espowerSource,
    baseAssert
) {
    var weave = function (line) {
        return espowerSource(line, '/path/to/some_test.js');
    },
    fakeFormatter = function (context) {
        var events = context.args.reduce(function (accum, arg) {
            return accum.concat(arg.events);
        }, []);
        return [
            context.source.filepath,
            context.source.content,
            JSON.stringify(events)
        ].join('\n');
    };


function testWithOption (option) {
    var assert = empower(baseAssert, fakeFormatter, option);


test('Bug reproduction. should not fail if argument is null Literal. ' + JSON.stringify(option), function () {
    var foo = 'foo';
    try {
        eval(weave('assert.equal(foo, null);'));
        baseAssert.ok(false, 'AssertionError should be thrown');
    } catch (e) {
        baseAssert.equal(e.name, 'AssertionError');
        if (option.modifyMessageOnFail) {
            baseAssert.equal(e.message, [
                '/path/to/some_test.js',
                'assert.equal(foo, null)',
                '[{"value":"foo","espath":"arguments/0"}]'
            ].join('\n'));
        }<commit_msg>test(empower): add test for default options behavior<commit_after>(function (root, factory) {
    'use strict';
    if (typeof define === 'function' && define.amd) {
        define(['empower', 'espower-source', 'assert'], factory);
    } else if (typeof exports === 'object') {
        factory(require('..'), require('espower-source'), require('assert'));
    } else {
        factory(root.empower, root.espowerSource, root.assert);
    }
}(this, function (
    empower,
    espowerSource,
    baseAssert
) {
    var weave = function (line) {
        return espowerSource(line, '/path/to/some_test.js');
    },
    fakeFormatter = function (context) {
        var events = context.args.reduce(function (accum, arg) {
            return accum.concat(arg.events);
        }, []);
        return [
            context.source.filepath,
            context.source.content,
            JSON.stringify(events)
        ].join('\n');
    };


test('default options behavior', function () {
    var weave = function (line) {
        return espowerSource(line, '/path/to/some_test.js');
    };
    var assert = empower(baseAssert, fakeFormatter);

    var falsy = 0;
    try {
        eval(weave('assert(falsy);'));
        baseAssert.ok(false, 'AssertionError should be thrown');
    } catch (e) {
        baseAssert.equal(e.name, 'AssertionError');
        baseAssert.equal(e.message, [
            '/path/to/some_test.js',
            'assert(falsy)',
            '[{"value":0,"espath":"arguments/0"}]'
        ].join('\n'));
    }
});


function testWithOption (option) {
    var assert = empower(baseAssert, fakeFormatter, option);


test('Bug reproduction. should not fail if argument is null Literal. ' + JSON.stringify(option), function () {
    var foo = 'foo';
    try {
        eval(weave('assert.equal(foo, null);'));
        baseAssert.ok(false, 'AssertionError should be thrown');
    } catch (e) {
        baseAssert.equal(e.name, 'AssertionError');
        if (option.modifyMessageOnFail) {
            baseAssert.equal(e.message, [
                '/path/to/some_test.js',
                'assert.equal(foo, null)',
                '[{"value":"foo","espath":"arguments/0"}]'
            ].join('\n'));
        }
{'fraction_non_alphanumeric': 0.16188470650171097, 'fraction_numerical': 0.0013161358252171624, 'mean_word_length': 2.408071748878924, 'pattern_counts': {'":': 6, '<': 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': '6572317', 'n_tokens_mistral': 1122, 'n_tokens_neox': 1108, 'n_words': 232}