<commit_before>// LICENSE : MIT
"use strict";
var assert = require("power-assert");
var createFormatter = require("../");
describe("textlint-formatter-test", function () {
    describe("createFormatter", function () {
        it("should return formatter function", function () {
            var formatter = createFormatter({
                formatterName: "stylish"
            });
            assert(typeof formatter === "function");
        });
        context("formatter", function () {
            it("should return output text", function () {
                var formatter = createFormatter({
                    formatterName: "stylish"
                });
                var output = formatter([
                    {
                        filePath: "./myfile.js",
                        messages: [
                            {
                                ruleId: "semi",
                                line: 1,
                                column: 23,
                                message: "Expected a semicolon."
                            }
                        ]
                    }
                ]);
                assert(output.length > 0);
            });
        });
        it("run all formatter", function () {
            var formatterNames = [
                "checkstyle",
                "compact",
                "jslint-xml",
                "junit",
                "pretty-error",
                "stylish",
                "tap",
                "json"
            ];
            formatterNames.forEach(function (name) {
                var formatter = createFormatter({
                    formatterName: name
                });
                var output = formatter([
                    {
                        filePath: __dirname + "/fixtures/myfile.js",
                        messages: [
                            {
                                ruleId: "semi",
                                line: 1,
                                column: 0,
                                message: "0 pattern."
                            },
                            {
                                ruleId: "semi",
                                line: 2,<commit_msg>fix(test): column number start with 1<commit_after>// LICENSE : MIT
"use strict";
var assert = require("power-assert");
var createFormatter = require("../");
describe("textlint-formatter-test", function () {
    describe("createFormatter", function () {
        it("should return formatter function", function () {
            var formatter = createFormatter({
                formatterName: "stylish"
            });
            assert(typeof formatter === "function");
        });
        context("formatter", function () {
            it("should return output text", function () {
                var formatter = createFormatter({
                    formatterName: "stylish"
                });
                var output = formatter([
                    {
                        filePath: "./myfile.js",
                        messages: [
                            {
                                ruleId: "semi",
                                line: 1,
                                column: 23,
                                message: "Expected a semicolon."
                            }
                        ]
                    }
                ]);
                assert(output.length > 0);
            });
        });
        it("run all formatter", function () {
            var formatterNames = [
                "checkstyle",
                "compact",
                "jslint-xml",
                "junit",
                "pretty-error",
                "stylish",
                "tap",
                "json"
            ];
            formatterNames.forEach(function (name) {
                var formatter = createFormatter({
                    formatterName: name
                });
                var output = formatter([
                    {
                        filePath: __dirname + "/fixtures/myfile.js",
                        messages: [
                            {
                                ruleId: "semi",
                                line: 1,
                                column: 1,
                                message: "0 pattern."
                            },
                            {
                                ruleId: "semi",
                                line: 2,
{'fraction_non_alphanumeric': 0.09794734493529675, 'fraction_numerical': 0.0037929495760821064, 'mean_word_length': 0.7817965023847376, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '7198174', 'n_tokens_mistral': 998, 'n_tokens_neox': 896, 'n_words': 202}