Skip to content

Commit 75943e5

Browse files
committed
test(end-to-end): separate load test
1 parent df10abf commit 75943e5

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

test/end-to-end.test.ts

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
11
import * as plugin from '../src';
2-
import { Plugin, RuleOutcome, RulesConfig } from '@commitlint/types';
2+
import { Plugin, QualifiedRules, RuleOutcome } from '@commitlint/types';
33
import { describe, expect, it } from '@jest/globals';
44
import lint from '@commitlint/lint';
55
import load from '@commitlint/load';
66

77
describe('commitlint plugin function rules', () => {
8+
it('can be loaded using @commitlint/load', async () => {
9+
await expect(
10+
load({
11+
plugins: [plugin as Plugin],
12+
}),
13+
).resolves.not.toThrow();
14+
});
15+
816
it('provides rules that can be used with commitlint', async () => {
917
for await (const rule of Object.keys(plugin.rules)) {
1018
const results: RuleOutcome[] = [
1119
[true],
1220
[false, `error message from ${rule}`],
1321
];
22+
1423
for await (const result of results) {
15-
const rules: Partial<RulesConfig> = {};
24+
const rules: Partial<QualifiedRules> = {};
1625
rules[rule] = [
1726
2,
1827
'always',
@@ -21,12 +30,7 @@ describe('commitlint plugin function rules', () => {
2130
},
2231
];
2332

24-
const config = await load({
25-
plugins: [plugin as Plugin],
26-
rules,
27-
});
28-
29-
const report = await lint('chore: basic commit message', config.rules, {
33+
const report = await lint('chore: basic commit message', rules, {
3034
plugins: {
3135
'function-rules': plugin as Plugin,
3236
},

0 commit comments

Comments
 (0)