Skip to content

Commit e7e5d5b

Browse files
test: improve tests of rule and config existence
1 parent abd8a54 commit e7e5d5b

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

tests/configs.test.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,17 @@ import noStatements from "~/configs/no-statements";
1414
import stylistic from "~/configs/stylistic";
1515
import { rules } from "~/rules";
1616

17-
test('Config "All" - should have all the rules', (t) => {
18-
const allRules = Object.keys(rules);
17+
test('Config "All" - should have all the non-deprecated rules', (t) => {
18+
const allRules = Object.values(rules);
19+
const allNonDeprecatedRules = allRules.filter(
20+
(rule) => rule.meta.deprecated !== true
21+
);
1922

2023
const configAllJSRules = Object.keys(all.rules ?? {});
2124
const configAllTSRules = Object.keys(all.overrides?.[0].rules ?? {});
2225
const configAllRules = new Set([...configAllJSRules, ...configAllTSRules]);
2326

24-
t.is(configAllRules.size, allRules.length);
27+
t.is(configAllRules.size, allNonDeprecatedRules.length);
2528
});
2629

2730
/**

tests/index.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ test("should have all the rules", (t) => {
2020
Object.prototype.hasOwnProperty.call(plugin, "rules"),
2121
'The plugin\'s config object should have a "rules" property.'
2222
);
23-
t.assert(Object.keys(plugin.rules).length === ruleFiles.length);
23+
t.is(ruleFiles.length, Object.keys(plugin.rules).length);
2424
});
2525

2626
test("should have all the configs", (t) => {
2727
t.true(
2828
Object.prototype.hasOwnProperty.call(plugin, "configs"),
2929
'The plugin\'s config object should have a "configs" property.'
3030
);
31-
t.assert(Object.keys(plugin.configs).length === configFiles.length);
31+
t.is(configFiles.length, Object.keys(plugin.configs).length);
3232
});

0 commit comments

Comments
 (0)