@@ -71,15 +71,12 @@ describe('eslintPlugin', () => {
7171 ) ;
7272 } ) ;
7373
74- it ( 'should initialize with plugin options for custom rules ' , async ( ) => {
74+ it ( 'should initialize with plugin options for custom groups ' , async ( ) => {
7575 cwdSpy . mockReturnValue ( path . join ( fixturesDir , 'nx-monorepo' ) ) ;
7676 const plugin = await eslintPlugin (
7777 {
7878 eslintrc : './packages/nx-plugin/eslint.config.js' ,
79- patterns : [
80- 'packages/nx-plugin/**/*.ts' ,
81- 'packages/nx-plugin/**/*.json' ,
82- ] ,
79+ patterns : [ 'packages/nx-plugin/**/*.ts' ] ,
8380 } ,
8481 {
8582 groups : [
@@ -114,11 +111,36 @@ describe('eslintPlugin', () => {
114111 ) ;
115112 } ) ;
116113
114+ it ( 'should throw when custom group rules are empty' , async ( ) => {
115+ await expect (
116+ eslintPlugin (
117+ {
118+ eslintrc : './packages/nx-plugin/eslint.config.js' ,
119+ patterns : [ 'packages/nx-plugin/**/*.ts' ] ,
120+ } ,
121+ {
122+ groups : [ { slug : 'type-safety' , title : 'Type safety' , rules : [ ] } ] ,
123+ } ,
124+ ) ,
125+ ) . rejects . toThrow ( / C u s t o m g r o u p r u l e s m u s t c o n t a i n a t l e a s t 1 e l e m e n t / ) ;
126+ await expect (
127+ eslintPlugin (
128+ {
129+ eslintrc : './packages/nx-plugin/eslint.config.js' ,
130+ patterns : [ 'packages/nx-plugin/**/*.ts' ] ,
131+ } ,
132+ {
133+ groups : [ { slug : 'type-safety' , title : 'Type safety' , rules : { } } ] ,
134+ } ,
135+ ) ,
136+ ) . rejects . toThrow ( / C u s t o m g r o u p r u l e s m u s t c o n t a i n a t l e a s t 1 e l e m e n t / ) ;
137+ } ) ;
138+
117139 it ( 'should throw when invalid parameters provided' , async ( ) => {
118140 await expect (
119141 // @ts -expect-error simulating invalid non-TS config
120142 eslintPlugin ( { eslintrc : '.eslintrc.json' } ) ,
121- ) . rejects . toThrow ( 'patterns' ) ;
143+ ) . rejects . toThrow ( / I n v a l i d i n p u t / ) ;
122144 } ) ;
123145
124146 it ( "should throw if eslintrc file doesn't exist" , async ( ) => {
0 commit comments