@@ -84,6 +84,88 @@ suite('FileSearchEngine', () => {
8484 } ) ;
8585 } ) ;
8686
87+ test ( 'Files: exists' , function ( done : ( ) => void ) {
88+ let engine = new FileSearchEngine ( {
89+ folderQueries : ROOT_FOLDER_QUERY ,
90+ includePattern : { '**/file.txt' : true } ,
91+ exists : true
92+ } ) ;
93+
94+ let count = 0 ;
95+ engine . search ( ( result ) => {
96+ if ( result ) {
97+ count ++ ;
98+ }
99+ } , ( ) => { } , ( error , complete ) => {
100+ assert . ok ( ! error ) ;
101+ assert . equal ( count , 0 ) ;
102+ assert . ok ( complete . limitHit ) ;
103+ done ( ) ;
104+ } ) ;
105+ } ) ;
106+
107+ test ( 'Files: not exists' , function ( done : ( ) => void ) {
108+ let engine = new FileSearchEngine ( {
109+ folderQueries : ROOT_FOLDER_QUERY ,
110+ includePattern : { '**/nofile.txt' : true } ,
111+ exists : true
112+ } ) ;
113+
114+ let count = 0 ;
115+ engine . search ( ( result ) => {
116+ if ( result ) {
117+ count ++ ;
118+ }
119+ } , ( ) => { } , ( error , complete ) => {
120+ assert . ok ( ! error ) ;
121+ assert . equal ( count , 0 ) ;
122+ assert . ok ( ! complete . limitHit ) ;
123+ done ( ) ;
124+ } ) ;
125+ } ) ;
126+
127+ test ( 'Files: exists without Ripgrep' , function ( done : ( ) => void ) {
128+ let engine = new FileSearchEngine ( {
129+ folderQueries : ROOT_FOLDER_QUERY ,
130+ includePattern : { '**/file.txt' : true } ,
131+ exists : true ,
132+ useRipgrep : false
133+ } ) ;
134+
135+ let count = 0 ;
136+ engine . search ( ( result ) => {
137+ if ( result ) {
138+ count ++ ;
139+ }
140+ } , ( ) => { } , ( error , complete ) => {
141+ assert . ok ( ! error ) ;
142+ assert . equal ( count , 0 ) ;
143+ assert . ok ( complete . limitHit ) ;
144+ done ( ) ;
145+ } ) ;
146+ } ) ;
147+
148+ test ( 'Files: not exists without Ripgrep' , function ( done : ( ) => void ) {
149+ let engine = new FileSearchEngine ( {
150+ folderQueries : ROOT_FOLDER_QUERY ,
151+ includePattern : { '**/nofile.txt' : true } ,
152+ exists : true ,
153+ useRipgrep : false
154+ } ) ;
155+
156+ let count = 0 ;
157+ engine . search ( ( result ) => {
158+ if ( result ) {
159+ count ++ ;
160+ }
161+ } , ( ) => { } , ( error , complete ) => {
162+ assert . ok ( ! error ) ;
163+ assert . equal ( count , 0 ) ;
164+ assert . ok ( ! complete . limitHit ) ;
165+ done ( ) ;
166+ } ) ;
167+ } ) ;
168+
87169 test ( 'Files: examples/com*' , function ( done : ( ) => void ) {
88170 let engine = new FileSearchEngine ( {
89171 folderQueries : ROOT_FOLDER_QUERY ,
0 commit comments