Skip to content

Commit 964e24b

Browse files
committed
test: add test compatibility for combined v19 and v20 lint and load tests
1 parent 14c3118 commit 964e24b

3 files changed

Lines changed: 11 additions & 8 deletions

File tree

package.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,6 @@
6060
"text-summary"
6161
]
6262
},
63-
"overrides": {
64-
"@commitlint/config-conventional": {
65-
"conventional-changelog-conventionalcommits": ">=9.0.0"
66-
}
67-
},
6863
"devDependencies": {
6964
"@ava/typescript": "6.0.0",
7065
"@commitlint/cli": "20.4.2",

src/function-rule.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ test('calls an implementation fuction once', async (t) => {
1212
test('passes arguments to an implementation function', async (t) => {
1313
const implementation = fake();
1414
const commit = {type: 'test'};
15-
await functionRule(commit as Commit, 'always', implementation);
15+
await functionRule(commit as unknown as Commit, 'always', implementation);
1616
t.deepEqual(implementation.firstCall.args, [commit, 'always']);
1717
});
1818

src/index.test.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ const loadPlugin = test.macro<[keyof typeof versions]>({
2626
* configuration.
2727
*/
2828
await t.notThrowsAsync(
29-
versions[version].load({plugins: [plugin]}, {file: 'package.json'}),
29+
versions[version].load(
30+
{plugins: [plugin as unknown as any]},
31+
{file: 'package.json'},
32+
),
3033
);
3134
},
3235
title(_, version) {
@@ -37,6 +40,10 @@ const loadPlugin = test.macro<[keyof typeof versions]>({
3740
test(loadPlugin, '19.x');
3841
test(loadPlugin, '20.x');
3942

43+
test('@commitlint/load@19.xx can load the plugin', async (t) => {
44+
await t.notThrowsAsync(load20x({plugins: [plugin]}, {file: 'package.json'}));
45+
});
46+
4047
/**
4148
* The type of the `RulesConfig` have changed in [commitlint v20.3.1](
4249
* https://github.com/conventional-changelog/commitlint/releases/tag/v20.3.1),
@@ -72,7 +79,8 @@ const lintUsingPluginRules = test.macro<[keyof typeof versions]>({
7279
: () => config.ruleOutcome,
7380
],
7481
} as unknown as any,
75-
{plugins: {'function-rules': plugin}},
82+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
83+
{plugins: {'function-rules': plugin as unknown as any}},
7684
);
7785

7886
const message = `rule "${rule}" can't be used by commitlint`;

0 commit comments

Comments
 (0)