@@ -1097,6 +1097,74 @@ describe('ConfigArray', () => {
10971097 expect ( configs . isFileIgnored ( path . join ( basePath , 'foo/a.js' ) ) ) . to . be . false ;
10981098 } ) ;
10991099
1100+ // https://github.com/eslint/eslint/pull/16579/files
1101+ describe ( 'gitignore-style unignores' , ( ) => {
1102+
1103+ it ( 'should return true when a subdirectory is ignored and then we try to unignore a directory' , ( ) => {
1104+ configs = new ConfigArray ( [
1105+ {
1106+ ignores : [
1107+ '/**/node_modules/*' ,
1108+ '!/node_modules/foo'
1109+ ] ,
1110+ }
1111+ ] , { basePath } ) ;
1112+
1113+ configs . normalizeSync ( ) ;
1114+ const filename = path . resolve ( basePath , 'node_modules/foo/bar.js' ) ;
1115+
1116+ expect ( configs . isFileIgnored ( filename ) ) . to . be . true ;
1117+ } ) ;
1118+
1119+ it ( 'should return true when a subdirectory is ignored and then we try to unignore a file' , ( ) => {
1120+ configs = new ConfigArray ( [
1121+ {
1122+ ignores : [
1123+ '/**/node_modules/*' ,
1124+ '!/node_modules/foo/**'
1125+ ] ,
1126+ }
1127+ ] , { basePath } ) ;
1128+
1129+ configs . normalizeSync ( ) ;
1130+ const filename = path . resolve ( basePath , 'node_modules/foo/bar.js' ) ;
1131+
1132+ expect ( configs . isFileIgnored ( filename ) ) . to . be . true ;
1133+ } ) ;
1134+
1135+ it ( 'should return true when all descendant directories are ignored and then we try to unignore a file' , ( ) => {
1136+ configs = new ConfigArray ( [
1137+ {
1138+ ignores : [
1139+ '/**/node_modules/**' ,
1140+ '!/node_modules/foo/**'
1141+ ] ,
1142+ }
1143+ ] , { basePath } ) ;
1144+
1145+ configs . normalizeSync ( ) ;
1146+ const filename = path . resolve ( basePath , 'node_modules/foo/bar.js' ) ;
1147+
1148+ expect ( configs . isFileIgnored ( filename ) ) . to . be . true ;
1149+ } ) ;
1150+
1151+ it ( 'should return true when all descendant directories are ignored without leading slash and then we try to unignore a file' , ( ) => {
1152+ configs = new ConfigArray ( [
1153+ {
1154+ ignores : [
1155+ '**/node_modules/**' ,
1156+ '!/node_modules/foo/**'
1157+ ] ,
1158+ }
1159+ ] , { basePath } ) ;
1160+
1161+ configs . normalizeSync ( ) ;
1162+ const filename = path . resolve ( basePath , 'node_modules/foo/bar.js' ) ;
1163+
1164+ expect ( configs . isFileIgnored ( filename ) ) . to . be . true ;
1165+ } ) ;
1166+ } ) ;
1167+
11001168 } ) ;
11011169
11021170 describe ( 'isDirectoryIgnored()' , ( ) => {
0 commit comments