@@ -84,30 +84,15 @@ describe('ForceIgnore', () => {
84
84
forceIgnore = new ForceIgnore ( ) ;
85
85
} ) ;
86
86
87
- it ( 'Should ignore files starting with a dot' , ( ) => {
88
- const dotPath = join ( root , '.xyz' ) ;
89
-
90
- expect ( forceIgnore . accepts ( dotPath ) ) . to . be . false ;
91
- expect ( forceIgnore . denies ( dotPath ) ) . to . be . true ;
92
- } ) ;
93
-
94
- it ( 'Should ignore files ending in .dup' , ( ) => {
95
- const dupPath = join ( root , 'abc.dup' ) ;
96
-
97
- expect ( forceIgnore . accepts ( dupPath ) ) . to . be . false ;
98
- expect ( forceIgnore . denies ( dupPath ) ) . to . be . true ;
99
- } ) ;
100
-
101
- it ( 'Should ignore files named package2-descriptor.json' , ( ) => {
102
- const descriptorPath = join ( root , 'package2-descriptor.json' ) ;
103
- expect ( forceIgnore . accepts ( descriptorPath ) ) . to . be . false ;
104
- expect ( forceIgnore . denies ( descriptorPath ) ) . to . be . true ;
105
- } ) ;
106
-
107
- it ( 'Should ignore files named package2-manifest.json' , ( ) => {
108
- const manifestPath = join ( root , 'package2-manifest.json' ) ;
109
- expect ( forceIgnore . accepts ( manifestPath ) ) . to . be . false ;
110
- expect ( forceIgnore . denies ( manifestPath ) ) . to . be . true ;
87
+ // the example's index here is specific to the rules order in ForceIgnore.DEFAULT_IGNORE
88
+ const forceIgnoreExamples = [ 'abc.dup' , '.xyz' , 'package2-descriptor.json' , 'package2-manifest.json' ] ;
89
+ forceIgnoreExamples . map ( ( ignore ) => {
90
+ it ( `Should ignore files starting with a ${ ignore } ` , ( ) => {
91
+ const testPath = join ( root , ignore ) ;
92
+
93
+ expect ( forceIgnore . accepts ( testPath ) ) . to . be . false ;
94
+ expect ( forceIgnore . denies ( testPath ) ) . to . be . true ;
95
+ } ) ;
111
96
} ) ;
112
97
113
98
it ( 'Should allow .forceignore file to override defaults' , ( ) => {
0 commit comments