@@ -20,7 +20,6 @@ describe('package', function () {
20
20
} ) ;
21
21
22
22
it ( 'has every rule' , function ( done ) {
23
-
24
23
fs . readdir (
25
24
path . join ( pkg , 'rules' )
26
25
, function ( err , files ) {
@@ -34,7 +33,7 @@ describe('package', function () {
34
33
} ) ;
35
34
} ) ;
36
35
37
- it ( 'exports all configs' , function ( done ) {
36
+ it ( 'exports all legacy configs' , function ( done ) {
38
37
fs . readdir ( path . join ( process . cwd ( ) , 'config' ) , function ( err , files ) {
39
38
if ( err ) { done ( err ) ; return ; }
40
39
files . filter ( isJSFile ) . forEach ( ( file ) => {
@@ -45,6 +44,38 @@ describe('package', function () {
45
44
} ) ;
46
45
} ) ;
47
46
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 object as default export' , function ( ) {
64
+ expect ( module . default ) . to . be . an ( 'object' ) . that . has . all . keys ( [ 'meta' , 'rules' , 'configs' , 'flatConfigs' ] ) ;
65
+ } ) ;
66
+
67
+ it ( 'includes plugin meta object in default export' , function ( ) {
68
+ expect ( module . default . meta ) . to . be . an ( 'object' ) . that . has . all . keys ( 'name' , 'version' ) ;
69
+ expect ( module . default . meta . name ) . to . equal ( 'eslint-plugin-import' ) ;
70
+ expect ( module . default . meta . version ) . to . be . a ( 'string' ) ;
71
+ } ) ;
72
+
73
+ it ( 'uses default export as plugin in flat configs' , function ( ) {
74
+ for ( const configFile in module . flatConfigs ) {
75
+ expect ( module . flatConfigs [ configFile ] . plugins . import ) . to . equal ( module . default ) ;
76
+ }
77
+ } ) ;
78
+
48
79
function getRulePath ( ruleName ) {
49
80
// 'require' does not work with dynamic paths because of the compilation step by babel
50
81
// (which resolves paths according to the root folder configuration)
0 commit comments