Skip to content

Commit

Permalink
chore: fix several cli tests to run in the intended flat config mode (
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjermanovic authored Nov 27, 2023
1 parent fffca5c commit b29a16b
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions tests/lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});

Expand Down Expand Up @@ -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
});

Expand All @@ -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
});

Expand Down Expand Up @@ -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
});

Expand Down Expand Up @@ -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
});
Expand Down Expand Up @@ -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
});
Expand All @@ -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);
});
Expand All @@ -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
});
Expand Down Expand Up @@ -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
});
Expand Down Expand Up @@ -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
});
Expand Down Expand Up @@ -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
});
Expand Down Expand Up @@ -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
});
Expand All @@ -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
});
Expand Down

0 comments on commit b29a16b

Please sign in to comment.