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

Code before:
        });

        describe("if { files: 'foo/**/*' } is present,", () => {

            const { prepare, cleanup, getPath } = createCustomTeardown({
                cwd: root + 4,
                files: {
                    "eslint.config.js": `module.exports = [
                        {
                            files: ["foo/**/*"]
                        }
                    ]`,
                    "foo/nested/test.txt": "",
                    "foo/test.js": "",
                    "foo/test.txt": "",
                    "bar/test.js": "",
                    "bar/test.txt": "",
                    "test.js": "",
                    "test.txt": ""
                }
            });

            beforeEach(prepare);
            afterEach(cleanup);

            it("'lintFiles()' with a directory path should contain 'foo/test.txt' and 'foo/nested/test.txt'.", async () => {
                const engine = new FlatESLint({ cwd: getPath() });
                const filePaths = (await engine.lintFiles("."))
                    .map(r => r.filePath)
                    .sort();

                assert.deepStrictEqual(filePaths, [
                    path.join(getPath(), "bar/test.js"),
                    path.join(getPath(), "eslint.config.js"),
                    path.join(getPath(), "foo/nested/test.txt"),
                    path.join(getPath(), "foo/test.js"),
                    path.join(getPath(), "foo/test.txt"),
                    path.join(getPath(), "test.js")
                ]);
            });
        });

    });

    describe("'ignores', 'files' of the configuration that the '--config' option provided should be resolved from CWD.", () => {
        const root = getFixturePath("cli-engine/config-and-overrides-files");

        describe("if { files: 'foo/*.txt', ... } is present by '--config node_modules/myconf/eslint.config.js',", () => {
            const { prepare, cleanup, getPath } = createCustomTeardown({
                cwd: `${root}a1`,
                files: {

Review comment (suggestion):
For some reason `foo/**/*` was NOT matching `.txt` files prior to the changes in this PR. That seems like a mistake based on how flat config is intended to work, so I updated this test.

Code after:
                    path.join(getPath(), "test.js")
                ]);
            });

            it("'lintFiles()' with a glob pattern '*.js' should not contain 'foo/test.txt'.", async () => {
                const engine = new FlatESLint({ cwd: getPath() });
                const filePaths = (await engine.lintFiles("**/*.js"))
                    .map(r => r.filePath)
                    .sort();

                assert.deepStrictEqual(filePaths, [
                    path.join(getPath(), "bar/test.js"),
                    path.join(getPath(), "eslint.config.js"),
                    path.join(getPath(), "foo/test.js"),
                    path.join(getPath(), "test.js")
                ]);
            });
        });

        describe("if { files: 'foo/*.txt', ignores: '**/ignore.txt' } is present and subdirectory is passed,", () => {
            const { prepare, cleanup, getPath } = createCustomTeardown({
                cwd: root + 2,
                files: {
                    "eslint.config.js": `module.exports = [{
                        files: ["foo/*.txt"],
                        ignores: ["**/ignore.txt"]
                    }];`,
                    "foo/nested/test.txt": "",
                    "foo/test.js": "",
                    "foo/test.txt": "",
                    "foo/ignore.txt": "",
                    "bar/test.js": "",
                    "bar/test.txt": "",
                    "bar/ignore.txt": "",
                    "test.js": "",
                    "test.txt": "",
                    "ignore.txt": ""
                }
            });

            beforeEach(prepare);
            afterEach(cleanup);

            it("'lintFiles()' with a directory path should contain 'foo/test.txt'.", async () => {
                const engine = new FlatESLint({ cwd: getPath() });
                const filePaths = (await engine.lintFiles("foo"))
                    .map(r => r.filePath)
                    .sort();

                assert.deepStrictEqual(filePaths, [
                    path.join(getPath(), "foo/test.js"),