11import * as plugin from '../src' ;
2- import { Plugin , RuleOutcome , RulesConfig } from '@commitlint/types' ;
2+ import { Plugin , QualifiedRules , RuleOutcome } from '@commitlint/types' ;
33import { describe , expect , it } from '@jest/globals' ;
44import lint from '@commitlint/lint' ;
55import load from '@commitlint/load' ;
66
77describe ( '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