diff --git a/tests/lib/cli-engine/file-enumerator.js b/tests/lib/cli-engine/file-enumerator.js index 516bfdfb659..88dfce6bd7e 100644 --- a/tests/lib/cli-engine/file-enumerator.js +++ b/tests/lib/cli-engine/file-enumerator.js @@ -457,7 +457,7 @@ describe("FileEnumerator", () => { }); it("should throw an error if no files match a glob", () => { - const patterns = ["tests/fixtures/glob-util/ignored/**/*.js"]; + const patterns = ["dir-does-not-exist/**/*.js"]; assert.throws(() => { listFiles(patterns, { cwd: getFixturePath("ignored-paths") }); diff --git a/tests/lib/eslint/eslint.js b/tests/lib/eslint/eslint.js index 75634849098..dffd7910dda 100644 --- a/tests/lib/eslint/eslint.js +++ b/tests/lib/eslint/eslint.js @@ -286,6 +286,22 @@ describe("ESLint", () => { ].join("\n")), "u") ); }); + + it("should warn if .eslintignore file is present", async () => { + const cwd = getFixturePath("ignored-paths"); + + sinon.restore(); + const processStub = sinon.stub(process, "emitWarning"); + + // eslint-disable-next-line no-new -- for testing purpose only + new ESLint({ cwd }); + + assert.strictEqual(processStub.callCount, 1, "calls `process.emitWarning()` once"); + assert.strictEqual(processStub.getCall(0).args[0], "The \".eslintignore\" file is no longer supported. Switch to using the \"ignores\" property in \"eslint.config.js\": https://eslint.org/docs/latest/use/configure/migration-guide#ignoring-files"); + assert.strictEqual(processStub.getCall(0).args[1], "ESLintIgnoreWarning"); + + processStub.restore(); + }); }); describe("lintText()", () => { @@ -4608,22 +4624,6 @@ describe("ESLint", () => { await assert.rejects(() => eslint.isPathIgnored(null), /'filePath' must be a non-empty string/u); }); - - it("should warn if .eslintignore file is present", async () => { - const cwd = getFixturePath("ignored-paths"); - - sinon.restore(); - const processStub = sinon.stub(process, "emitWarning"); - - // eslint-disable-next-line no-new -- for testing purpose only - new ESLint({ cwd }); - - assert.strictEqual(processStub.callCount, 1, "calls `process.emitWarning()` once"); - assert.strictEqual(processStub.getCall(0).args[0], "The \".eslintignore\" file is no longer supported. Switch to using the \"ignores\" property in \"eslint.config.js\": https://eslint.org/docs/latest/use/configure/migration-guide#ignoring-files"); - assert.strictEqual(processStub.getCall(0).args[1], "ESLintIgnoreWarning"); - - processStub.restore(); - }); }); describe("loadFormatter()", () => {