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

Code before:
                    shell.mkdir("-p", workDir);
                    shell.cp("-r", `./tests/fixtures/${workDirName}`, workDir);
                });

                after(() => {
                    shell.rm("-r", workDir);
                });

                it(`${flags}:should throw if eslint.config.js file is not present`, async () => {
                    eslint = new ESLint({
                        flags,
                        cwd: workDir
                    });
                    await assert.rejects(() => eslint.lintFiles("no-config-file/*.js"), /Could not find config file/u);
                });

                it("should throw if eslint.config.js file is not present even if overrideConfig was passed", async () => {
                    eslint = new ESLint({
                        cwd: getFixturePath(".."),
                        overrideConfig: {
                            rules: {
                                "no-unused-vars": 2
                            }
                        }
                    });
                    await assert.rejects(() => eslint.lintFiles("fixtures/undef*.js"), /Could not find config file/u);
                });

                it("should throw if eslint.config.js file is not present even if overrideConfig was passed and a file path is given", async () => {
                    eslint = new ESLint({
                        cwd: getFixturePath(".."),
                        overrideConfig: {
                            rules: {
                                "no-unused-vars": 2
                            }
                        }
                    });
                    await assert.rejects(() => eslint.lintFiles("fixtures/undef.js"), /Could not find config file/u);
                });

                it("should not throw if eslint.config.js file is not present and overrideConfigFile is `true`", async () => {
                    eslint = new ESLint({
                        flags,
                        cwd: workDir,
                        overrideConfigFile: true
                    });
                    await eslint.lintFiles("no-config-file/*.js");
                });

                it("should not throw if eslint.config.js file is not present and overrideConfigFile is path to a config file", async () => {
                    eslint = new ESLint({

Review comment (suggestion):
There's a config file in "fixtures", so this test wouldn't work with the `unstable_config_lookup_from_file` flag.

Code after:

                    shell.mkdir("-p", workDir);
                    shell.cp("-r", `./tests/fixtures/${workDirName}`, workDir);
                });

                after(() => {
                    shell.rm("-r", workDir);
                });

                it(`${flags}:should throw if eslint.config.js file is not present`, async () => {
                    eslint = new ESLint({
                        flags,
                        cwd: workDir
                    });
                    await assert.rejects(() => eslint.lintFiles("no-config-file/*.js"), /Could not find config file/u);
                });

                it("should throw if eslint.config.js file is not present even if overrideConfig was passed", async () => {
                    eslint = new ESLint({
                        flags,
                        cwd: getFixturePath(".."),
                        overrideConfig: {
                            rules: {
                                "no-unused-vars": 2
                            }
                        }
                    });
                    await assert.rejects(() => eslint.lintFiles("no-config/no-config-file/*.js"), /Could not find config file/u);
                });

                it("should throw if eslint.config.js file is not present even if overrideConfig was passed and a file path is given", async () => {
                    eslint = new ESLint({
                        flags,
                        cwd: getFixturePath(".."),
                        overrideConfig: {
                            rules: {
                                "no-unused-vars": 2
                            }
                        }
                    });
                    await assert.rejects(() => eslint.lintFiles("no-config/no-config-file/foo.js"), /Could not find config file/u);
                });

                it("should not throw if eslint.config.js file is not present and overrideConfigFile is `true`", async () => {
                    eslint = new ESLint({
                        flags,
                        cwd: workDir,
                        overrideConfigFile: true
                    });
                    await eslint.lintFiles("no-config-file/*.js");
                });