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

Code before:
            it(`should load the local config file with configType:${configType}`, async () => {
                await cli.execute("cli/passing.js --no-ignore", null, useFlatConfig);
            });

            if (useFlatConfig) {
                it(`should load the local config file with glob pattern and configType:${configType}`, async () => {
                    await cli.execute("cli/pass*.js --no-ignore", null, useFlatConfig);
                });
            }

            // only works on Windows
            if (os.platform() === "win32") {
                it(`should load the local config file with Windows slashes glob pattern and configType:${configType}`, async () => {
                    await cli.execute("cli\\pass*.js --no-ignore", null, useFlatConfig);
                });
            }
        });

        describe("Formatters", () => {

            const flag = useFlatConfig ? "--no-config-lookup" : "--no-eslintrc";

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

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

            describe("when given a valid built-in formatter name that uses rules meta.", () => {

                const originalCwd = process.cwd;

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

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

                it(`should execute without any errors with configType:${configType}`, async () => {
                    const filePath = getFixturePath("passing.js");
                    const exit = await cli.execute(`--no-ignore -f json-with-metadata ${filePath} ${flag}`, null, useFlatConfig);

                    assert.strictEqual(exit, 0);

                    /*
                     * Note: There is a behavior difference between eslintrc and flat config

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

Code after:
            it(`should load the local config file with configType:${configType}`, async () => {
                await cli.execute("cli/passing.js --no-ignore", null, useFlatConfig);
            });

            if (useFlatConfig) {
                it(`should load the local config file with glob pattern and configType:${configType}`, async () => {
                    await cli.execute("cli/pass*.js --no-ignore", null, useFlatConfig);
                });
            }

            // only works on Windows
            if (os.platform() === "win32") {
                it(`should load the local config file with Windows slashes glob pattern and configType:${configType}`, async () => {
                    await cli.execute("cli\\pass*.js --no-ignore", null, useFlatConfig);
                });
            }
        });

        describe("Formatters", () => {

            const flag = useFlatConfig ? "--no-config-lookup" : "--no-eslintrc";

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

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

            describe("when given a valid built-in formatter name that uses rules meta.", () => {

                const originalCwd = process.cwd;

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

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

                it(`should execute without any errors with configType:${configType}`, async () => {
                    const filePath = getFixturePath("passing.js");
                    const exit = await cli.execute(`--no-ignore -f json-with-metadata ${filePath} ${flag}`, null, useFlatConfig);

                    assert.strictEqual(exit, 0);

                    /*
                     * Note: There is a behavior difference between eslintrc and flat config