@@ -20,7 +20,6 @@ describe('package', function () {
2020 } ) ;
2121
2222 it ( 'has every rule' , function ( done ) {
23-
2423 fs . readdir (
2524 path . join ( pkg , 'rules' )
2625 , function ( err , files ) {
@@ -34,7 +33,7 @@ describe('package', function () {
3433 } ) ;
3534 } ) ;
3635
37- it ( 'exports all configs' , function ( done ) {
36+ it ( 'exports all legacy configs' , function ( done ) {
3837 fs . readdir ( path . join ( process . cwd ( ) , 'config' ) , function ( err , files ) {
3938 if ( err ) { done ( err ) ; return ; }
4039 files . filter ( isJSFile ) . forEach ( ( file ) => {
@@ -45,6 +44,34 @@ describe('package', function () {
4544 } ) ;
4645 } ) ;
4746
47+ it ( 'exports all flat configs' , function ( done ) {
48+ fs . readdir ( path . join ( process . cwd ( ) , 'config' ) , function ( err , files ) {
49+ if ( err ) { done ( err ) ; return ; }
50+ files . filter ( isJSFile ) . forEach ( ( file ) => {
51+ if ( file [ 0 ] === '.' ) { return ; }
52+
53+ const basename = path . basename ( file , '.js' ) ;
54+ // stage-0 is not included in flat configs
55+ if ( basename === 'stage-0' ) { return ; }
56+
57+ expect ( module . flatConfigs ) . to . have . property ( basename ) ;
58+ } ) ;
59+ done ( ) ;
60+ } ) ;
61+ } ) ;
62+
63+ it ( 'exports plugin meta object' , function ( ) {
64+ expect ( module . meta ) . to . be . an ( 'object' ) . that . has . all . keys ( 'name' , 'version' ) ;
65+ expect ( module . meta . name ) . to . equal ( 'eslint-plugin-import' ) ;
66+ expect ( module . meta . version ) . to . be . a ( 'string' ) ;
67+ } ) ;
68+
69+ it ( 'ensures the plugin object in the flat configs is identical to the module' , function ( ) {
70+ for ( const configFile in module . flatConfigs ) {
71+ expect ( module . flatConfigs [ configFile ] . plugins . import ) . to . equal ( module ) ;
72+ }
73+ } ) ;
74+
4875 function getRulePath ( ruleName ) {
4976 // 'require' does not work with dynamic paths because of the compilation step by babel
5077 // (which resolves paths according to the root folder configuration)
0 commit comments