Skip to content

Commit 468e3bd

Browse files
authored
test: fix ESLint tests (#19021)
1 parent 19e68d3 commit 468e3bd

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

tests/lib/eslint/eslint.js

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,7 @@ describe("ESLint", () => {
928928

929929
it("should throw if eslint.config.js file is not present even if overrideConfig was passed", async () => {
930930
eslint = new ESLint({
931+
flags,
931932
cwd: getFixturePath(".."),
932933
overrideConfig: {
933934
rules: {
@@ -1525,26 +1526,28 @@ describe("ESLint", () => {
15251526

15261527
it("should throw if eslint.config.js file is not present even if overrideConfig was passed", async () => {
15271528
eslint = new ESLint({
1529+
flags,
15281530
cwd: getFixturePath(".."),
15291531
overrideConfig: {
15301532
rules: {
15311533
"no-unused-vars": 2
15321534
}
15331535
}
15341536
});
1535-
await assert.rejects(() => eslint.lintFiles("fixtures/undef*.js"), /Could not find config file/u);
1537+
await assert.rejects(() => eslint.lintFiles("no-config/no-config-file/*.js"), /Could not find config file/u);
15361538
});
15371539

15381540
it("should throw if eslint.config.js file is not present even if overrideConfig was passed and a file path is given", async () => {
15391541
eslint = new ESLint({
1542+
flags,
15401543
cwd: getFixturePath(".."),
15411544
overrideConfig: {
15421545
rules: {
15431546
"no-unused-vars": 2
15441547
}
15451548
}
15461549
});
1547-
await assert.rejects(() => eslint.lintFiles("fixtures/undef.js"), /Could not find config file/u);
1550+
await assert.rejects(() => eslint.lintFiles("no-config/no-config-file/foo.js"), /Could not find config file/u);
15481551
});
15491552

15501553
it("should not throw if eslint.config.js file is not present and overrideConfigFile is `true`", async () => {
@@ -4643,7 +4646,7 @@ describe("ESLint", () => {
46434646
});
46444647
});
46454648

4646-
it("should throw if non-boolean value is given to 'options.warnIgnored' option", async () => {
4649+
it("should throw if an invalid value is given to 'patterns' argument", async () => {
46474650
eslint = new ESLint({ flags });
46484651
await assert.rejects(() => eslint.lintFiles(777), /'patterns' must be a non-empty string or an array of non-empty strings/u);
46494652
await assert.rejects(() => eslint.lintFiles([null]), /'patterns' must be a non-empty string or an array of non-empty strings/u);
@@ -5955,20 +5958,6 @@ describe("ESLint", () => {
59555958
assert.strictEqual(results[0].output, void 0);
59565959
});
59575960

5958-
it("should not fix any rules when fixTypes is used without fix", async () => {
5959-
eslint = new ESLint({
5960-
flags,
5961-
cwd: path.join(fixtureDir, ".."),
5962-
overrideConfigFile: true,
5963-
fix: false,
5964-
fixTypes: ["layout"]
5965-
});
5966-
const inputPath = getFixturePath("fix-types/fix-only-semi.js");
5967-
const results = await eslint.lintFiles([inputPath]);
5968-
5969-
assert.strictEqual(results[0].output, void 0);
5970-
});
5971-
59725961
it("should not fix non-style rules when fixTypes has only 'layout'", async () => {
59735962
eslint = new ESLint({
59745963
flags,

0 commit comments

Comments
 (0)