From b29a16b22f234f6134475efb6c7be5ac946556ee Mon Sep 17 00:00:00 2001 From: Milos Djermanovic Date: Mon, 27 Nov 2023 16:51:25 +0100 Subject: [PATCH] chore: fix several `cli` tests to run in the intended flat config mode (#17797) --- tests/lib/cli.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/lib/cli.js b/tests/lib/cli.js index ad0b8ad23272..339b35e5f85f 100644 --- a/tests/lib/cli.js +++ b/tests/lib/cli.js @@ -63,7 +63,7 @@ describe("cli", () => { const localCLI = proxyquire("../../lib/cli", { "./eslint": { ESLint: fakeESLint }, - "./flat-eslint": { FlatESLint: fakeESLint, shouldUseFlatConfig: () => Promise.resolve(false) }, + "./eslint/flat-eslint": { FlatESLint: fakeESLint, shouldUseFlatConfig: () => Promise.resolve(configType === "flat") }, "./shared/logging": log }); @@ -990,7 +990,7 @@ describe("cli", () => { localCLI = proxyquire("../../lib/cli", { "./eslint": { ESLint: fakeESLint }, - "./eslint/flat-eslint": { ESLint: fakeESLint, shouldUseFlatConfig: () => Promise.resolve(false) }, + "./eslint/flat-eslint": { FlatESLint: fakeESLint, shouldUseFlatConfig: () => Promise.resolve(useFlatConfig) }, "./shared/logging": log }); @@ -1009,7 +1009,7 @@ describe("cli", () => { localCLI = proxyquire("../../lib/cli", { "./eslint": { ESLint: fakeESLint }, - "./eslint/flat-eslint": { ESLint: fakeESLint, shouldUseFlatConfig: () => Promise.resolve(false) }, + "./eslint/flat-eslint": { FlatESLint: fakeESLint, shouldUseFlatConfig: () => Promise.resolve(useFlatConfig) }, "./shared/logging": log }); @@ -1040,7 +1040,7 @@ describe("cli", () => { localCLI = proxyquire("../../lib/cli", { "./eslint": { ESLint: fakeESLint }, - "./eslint/flat-eslint": { ESLint: fakeESLint, shouldUseFlatConfig: () => Promise.resolve(false) }, + "./eslint/flat-eslint": { FlatESLint: fakeESLint, shouldUseFlatConfig: () => Promise.resolve(useFlatConfig) }, "./shared/logging": log }); @@ -1076,7 +1076,7 @@ describe("cli", () => { localCLI = proxyquire("../../lib/cli", { "./eslint": { ESLint: fakeESLint }, - "./eslint/flat-eslint": { ESLint: fakeESLint, shouldUseFlatConfig: () => Promise.resolve(false) }, + "./eslint/flat-eslint": { FlatESLint: fakeESLint, shouldUseFlatConfig: () => Promise.resolve(useFlatConfig) }, "./shared/logging": log }); @@ -1113,7 +1113,7 @@ describe("cli", () => { localCLI = proxyquire("../../lib/cli", { "./eslint": { ESLint: fakeESLint }, - "./eslint/flat-eslint": { ESLint: fakeESLint, shouldUseFlatConfig: () => Promise.resolve(false) }, + "./eslint/flat-eslint": { FlatESLint: fakeESLint, shouldUseFlatConfig: () => Promise.resolve(useFlatConfig) }, "./shared/logging": log }); @@ -1131,12 +1131,12 @@ describe("cli", () => { localCLI = proxyquire("../../lib/cli", { "./eslint": { ESLint: fakeESLint }, - "./eslint/flat-eslint": { ESLint: fakeESLint, shouldUseFlatConfig: () => Promise.resolve(false) }, + "./eslint/flat-eslint": { FlatESLint: fakeESLint, shouldUseFlatConfig: () => Promise.resolve(useFlatConfig) }, "./shared/logging": log }); - const exitCode = await localCLI.execute("--fix .", "foo = bar;", null, useFlatConfig); + const exitCode = await localCLI.execute("--fix .", "foo = bar;", useFlatConfig); assert.strictEqual(exitCode, 2); }); @@ -1162,7 +1162,7 @@ describe("cli", () => { localCLI = proxyquire("../../lib/cli", { "./eslint": { ESLint: fakeESLint }, - "./eslint/flat-eslint": { ESLint: fakeESLint, shouldUseFlatConfig: () => Promise.resolve(false) }, + "./eslint/flat-eslint": { FlatESLint: fakeESLint, shouldUseFlatConfig: () => Promise.resolve(useFlatConfig) }, "./shared/logging": log }); @@ -1190,7 +1190,7 @@ describe("cli", () => { localCLI = proxyquire("../../lib/cli", { "./eslint": { ESLint: fakeESLint }, - "./eslint/flat-eslint": { ESLint: fakeESLint, shouldUseFlatConfig: () => Promise.resolve(false) }, + "./eslint/flat-eslint": { FlatESLint: fakeESLint, shouldUseFlatConfig: () => Promise.resolve(useFlatConfig) }, "./shared/logging": log }); @@ -1225,7 +1225,7 @@ describe("cli", () => { localCLI = proxyquire("../../lib/cli", { "./eslint": { ESLint: fakeESLint }, - "./eslint/flat-eslint": { ESLint: fakeESLint, shouldUseFlatConfig: () => Promise.resolve(false) }, + "./eslint/flat-eslint": { FlatESLint: fakeESLint, shouldUseFlatConfig: () => Promise.resolve(useFlatConfig) }, "./shared/logging": log }); @@ -1262,7 +1262,7 @@ describe("cli", () => { localCLI = proxyquire("../../lib/cli", { "./eslint": { ESLint: fakeESLint }, - "./eslint/flat-eslint": { ESLint: fakeESLint, shouldUseFlatConfig: () => Promise.resolve(false) }, + "./eslint/flat-eslint": { FlatESLint: fakeESLint, shouldUseFlatConfig: () => Promise.resolve(useFlatConfig) }, "./shared/logging": log }); @@ -1298,7 +1298,7 @@ describe("cli", () => { localCLI = proxyquire("../../lib/cli", { "./eslint": { ESLint: fakeESLint }, - "./eslint/flat-eslint": { ESLint: fakeESLint, shouldUseFlatConfig: () => Promise.resolve(false) }, + "./eslint/flat-eslint": { FlatESLint: fakeESLint, shouldUseFlatConfig: () => Promise.resolve(useFlatConfig) }, "./shared/logging": log }); @@ -1315,7 +1315,7 @@ describe("cli", () => { localCLI = proxyquire("../../lib/cli", { "./eslint": { ESLint: fakeESLint }, - "./eslint/flat-eslint": { ESLint: fakeESLint, shouldUseFlatConfig: () => Promise.resolve(false) }, + "./eslint/flat-eslint": { FlatESLint: fakeESLint, shouldUseFlatConfig: () => Promise.resolve(useFlatConfig) }, "./shared/logging": log });