Repository: eslint/eslint
File: tests/lib/cli.js (JavaScript)

Code before:
                            useFlatConfig
                        );

                        assert.strictEqual(exit, 0);

                        const { metadata } = JSON.parse(log.info.args[0][0]);

                        assert.notProperty(metadata, "maxWarningsExceeded");
                    });
                });
            });

            describe("when given an invalid built-in formatter name", () => {
                it(`should execute with error: with configType:${configType}`, async () => {
                    const filePath = getFixturePath("passing.js");
                    const exit = await cli.execute(`-f fakeformatter ${filePath} ${flag}`, null, configType === "flat");

                    assert.strictEqual(exit, 2);
                });
            });

            describe("when given a valid formatter path", () => {
                it(`should execute without any errors with configType:${configType}`, async () => {
                    const formatterPath = getFixturePath("formatters", "simple.js");
                    const filePath = getFixturePath("passing.js");
                    const exit = await cli.execute(`-f ${formatterPath} ${filePath} ${flag}`, null, configType === "flat");

                    assert.strictEqual(exit, 0);
                });
            });

            describe("when given an invalid formatter path", () => {

                const originalCwd = process.cwd;

                beforeEach(() => {
                    process.cwd = () => getFixturePath();
                });

                afterEach(() => {
                    process.cwd = originalCwd;
                });

                it(`should execute with error with configType:${configType}`, async () => {
                    const formatterPath = getFixturePath("formatters", "file-does-not-exist.js");
                    const filePath = getFixturePath("passing.js");
                    const exit = await cli.execute(`--no-ignore -f ${formatterPath} ${filePath}`, null, useFlatConfig);

                    assert.strictEqual(exit, 2);
                });
            });

Review comment (suggestion):
```suggestion
                    const exit = await cli.execute(`-f ${formatterPath} ${filePath} ${flag}`, null, useFlatConfig);
```

Code after:
                            { maxWarnings: 1, foundWarnings: 2 }
                        );
                    });
                });

                describe("and warnings do not exceed the limit", () => {
                    it(`should omit \`maxWarningsExceeded\` metadata from the formatter with configType:${configType}`, async () => {
                        const exit = await cli.execute(
                            `--no-ignore -f json-with-metadata --max-warnings 1 --rule 'quotes: warn' ${flag}`,
                            "'hello world';",
                            useFlatConfig
                        );

                        assert.strictEqual(exit, 0);

                        const { metadata } = JSON.parse(log.info.args[0][0]);

                        assert.notProperty(metadata, "maxWarningsExceeded");
                    });
                });
            });

            describe("when given an invalid built-in formatter name", () => {
                it(`should execute with error: with configType:${configType}`, async () => {
                    const filePath = getFixturePath("passing.js");
                    const exit = await cli.execute(`-f fakeformatter ${filePath} ${flag}`, null, useFlatConfig);

                    assert.strictEqual(exit, 2);
                });
            });

            describe("when given a valid formatter path", () => {
                it(`should execute without any errors with configType:${configType}`, async () => {
                    const formatterPath = getFixturePath("formatters", "simple.js");
                    const filePath = getFixturePath("passing.js");
                    const exit = await cli.execute(`-f ${formatterPath} ${filePath} ${flag}`, null, useFlatConfig);

                    assert.strictEqual(exit, 0);
                });
            });

            describe("when given an invalid formatter path", () => {

                const originalCwd = process.cwd;

                beforeEach(() => {
                    process.cwd = () => getFixturePath();
                });

                afterEach(() => {
                    process.cwd = originalCwd;