Repository: eslint/eslint
File: tests/lib/rule-tester/rule-tester.js (JavaScript)

Code before:
    });
    it("should throw an error if a new-format rule that doesn't have `meta` produces fixes", () => {
        const replaceProgramWith5Rule = {
            create(context) {
                return {
                    Program(node) {
                        context.report({ node, message: "bad", fix: fixer => fixer.replaceText(node, "5") });
                    }
                };
            }
        };

        assert.throws(() => {
            ruleTester.run("replaceProgramWith5", replaceProgramWith5Rule, {
                valid: [],
                invalid: [
                    { code: "var foo = bar;", output: "5", errors: 1 }
                ]
            });
        }, /Fixable rules must set the `meta\.fixable` property/u);
    });

    it("should allow test any file", () => {
        const filenames = [

            // Ignored by default
            "node_modules/foo.js",
            ".git/foo.js",

            /*
             * Absolute paths
             * https://github.com/eslint/eslint/issues/17962
             */
            "/an-absolute-path/foo.js",
            "C:\\an-absolute-path\\foo.js"
        ];

        ruleTester.run("no-eval", require("../../fixtures/testers/rule-tester/no-eval"), {
            valid: filenames.map((filename, index) => ({
                code: `Eval(foo${index})`,
                filename
            })),
            invalid: filenames.map((filename, index) => ({
                code: `eval(foo${index})`,
                errors: [{ message: "eval sucks.", type: "CallExpression" }],
                filename
            }))
        });
    });

    describe("suggestions", () => {

Review comment (suggestion):
```suggestion
            /*
             * Ignored by default
             * https://github.com/eslint/eslint/issues/19471
             */
```

Code after:
    });
    it("should throw an error if a new-format rule that doesn't have `meta` produces fixes", () => {
        const replaceProgramWith5Rule = {
            create(context) {
                return {
                    Program(node) {
                        context.report({ node, message: "bad", fix: fixer => fixer.replaceText(node, "5") });
                    }
                };
            }
        };

        assert.throws(() => {
            ruleTester.run("replaceProgramWith5", replaceProgramWith5Rule, {
                valid: [],
                invalid: [
                    { code: "var foo = bar;", output: "5", errors: 1 }
                ]
            });
        }, /Fixable rules must set the `meta\.fixable` property/u);
    });

    it("should allow testing of any file", () => {
        const filenames = [

            /*
             * Ignored by default
             * https://github.com/eslint/eslint/issues/19471
             */
            "node_modules/foo.js",
            ".git/foo.js",

            /*
             * Absolute paths
             * https://github.com/eslint/eslint/issues/17962
             */
            "/an-absolute-path/foo.js",
            "C:\\an-absolute-path\\foo.js"
        ];

        ruleTester.run("no-eval", require("../../fixtures/testers/rule-tester/no-eval"), {
            valid: filenames.map((filename, index) => ({
                code: `Eval(foo${index})`,
                filename
            })),
            invalid: filenames.map((filename, index) => ({
                code: `eval(foo${index})`,
                errors: [{ message: "eval sucks.", type: "CallExpression" }],
                filename
            }))
        });