@@ -17,7 +17,6 @@ describe("rg -I/--no-filename basic functionality", () => {
1717 const result = await bash . exec ( "rg -I hello" ) ;
1818 expect ( result . exitCode ) . toBe ( 0 ) ;
1919 expect ( result . stdout ) . toBe ( "1:hello world\n" ) ;
20- expect ( result . stdout ) . not . toContain ( "file.txt" ) ;
2120 } ) ;
2221
2322 it ( "should hide filename with --no-filename in directory search" , async ( ) => {
@@ -30,7 +29,6 @@ describe("rg -I/--no-filename basic functionality", () => {
3029 const result = await bash . exec ( "rg --no-filename test" ) ;
3130 expect ( result . exitCode ) . toBe ( 0 ) ;
3231 expect ( result . stdout ) . toBe ( "1:test line\n" ) ;
33- expect ( result . stdout ) . not . toContain ( "data.txt" ) ;
3432 } ) ;
3533
3634 it ( "should work without line numbers when combined with -N" , async ( ) => {
@@ -56,7 +54,6 @@ describe("rg -I/--no-filename basic functionality", () => {
5654 const result = await bash . exec ( "rg -I foo test.txt" ) ;
5755 expect ( result . exitCode ) . toBe ( 0 ) ;
5856 expect ( result . stdout ) . toBe ( "foo bar\n" ) ;
59- expect ( result . stdout ) . not . toContain ( "test.txt" ) ;
6057 } ) ;
6158} ) ;
6259
@@ -73,9 +70,6 @@ describe("rg -I with multiple files", () => {
7370 const result = await bash . exec ( "rg -I found" ) ;
7471 expect ( result . exitCode ) . toBe ( 0 ) ;
7572 expect ( result . stdout ) . toBe ( "1:found\n1:found\n1:found\n" ) ;
76- expect ( result . stdout ) . not . toContain ( "a.txt" ) ;
77- expect ( result . stdout ) . not . toContain ( "b.txt" ) ;
78- expect ( result . stdout ) . not . toContain ( "c.txt" ) ;
7973 } ) ;
8074
8175 it ( "should still show line numbers with multiple files" , async ( ) => {
@@ -86,12 +80,9 @@ describe("rg -I with multiple files", () => {
8680 "/home/user/second.txt" : "line three\n" ,
8781 } ,
8882 } ) ;
89- const result = await bash . exec ( "rg -I line" ) ;
83+ const result = await bash . exec ( "rg -I --sort path line" ) ;
9084 expect ( result . exitCode ) . toBe ( 0 ) ;
91- expect ( result . stdout ) . toContain ( "1:" ) ;
92- expect ( result . stdout ) . toContain ( "2:" ) ;
93- expect ( result . stdout ) . not . toContain ( "first.txt" ) ;
94- expect ( result . stdout ) . not . toContain ( "second.txt" ) ;
85+ expect ( result . stdout ) . toBe ( "1:line one\n2:line two\n1:line three\n" ) ;
9586 } ) ;
9687
9788 it ( "should hide filenames in subdirectories" , async ( ) => {
@@ -107,10 +98,6 @@ describe("rg -I with multiple files", () => {
10798 expect ( result . stdout ) . toBe (
10899 "1:export const y = 2;\n1:export const x = 1;\n" ,
109100 ) ;
110- expect ( result . stdout ) . not . toContain ( "app.ts" ) ;
111- expect ( result . stdout ) . not . toContain ( "util.ts" ) ;
112- expect ( result . stdout ) . not . toContain ( "src/" ) ;
113- expect ( result . stdout ) . not . toContain ( "lib/" ) ;
114101 } ) ;
115102} ) ;
116103
@@ -139,8 +126,6 @@ describe("rg -I with other flags", () => {
139126 const result = await bash . exec ( "rg -I -c x" ) ;
140127 expect ( result . exitCode ) . toBe ( 0 ) ;
141128 expect ( result . stdout ) . toBe ( "2\n3\n" ) ;
142- expect ( result . stdout ) . not . toContain ( "a.txt" ) ;
143- expect ( result . stdout ) . not . toContain ( "b.txt" ) ;
144129 } ) ;
145130
146131 it ( "should work with -o (only matching)" , async ( ) => {
@@ -153,7 +138,6 @@ describe("rg -I with other flags", () => {
153138 const result = await bash . exec ( "rg -I -o '[0-9]+'" ) ;
154139 expect ( result . exitCode ) . toBe ( 0 ) ;
155140 expect ( result . stdout ) . toBe ( "123\n456\n" ) ;
156- expect ( result . stdout ) . not . toContain ( "nums.txt" ) ;
157141 } ) ;
158142
159143 it ( "should work with -v (invert match)" , async ( ) => {
@@ -166,7 +150,6 @@ describe("rg -I with other flags", () => {
166150 const result = await bash . exec ( "rg -I -v remove" ) ;
167151 expect ( result . exitCode ) . toBe ( 0 ) ;
168152 expect ( result . stdout ) . toBe ( "1:keep\n3:keep\n" ) ;
169- expect ( result . stdout ) . not . toContain ( "file.txt" ) ;
170153 } ) ;
171154
172155 it ( "should work with -i (case insensitive)" , async ( ) => {
@@ -179,7 +162,6 @@ describe("rg -I with other flags", () => {
179162 const result = await bash . exec ( "rg -I -i hello" ) ;
180163 expect ( result . exitCode ) . toBe ( 0 ) ;
181164 expect ( result . stdout ) . toBe ( "1:Hello\n2:HELLO\n3:hello\n" ) ;
182- expect ( result . stdout ) . not . toContain ( "file.txt" ) ;
183165 } ) ;
184166
185167 it ( "should work with -w (word match)" , async ( ) => {
@@ -192,7 +174,6 @@ describe("rg -I with other flags", () => {
192174 const result = await bash . exec ( "rg -I -w foo" ) ;
193175 expect ( result . exitCode ) . toBe ( 0 ) ;
194176 expect ( result . stdout ) . toBe ( "1:foo bar\n3:bar foo baz\n" ) ;
195- expect ( result . stdout ) . not . toContain ( "file.txt" ) ;
196177 } ) ;
197178
198179 it ( "should work with -m (max count)" , async ( ) => {
@@ -205,7 +186,6 @@ describe("rg -I with other flags", () => {
205186 const result = await bash . exec ( "rg -I -m2 test" ) ;
206187 expect ( result . exitCode ) . toBe ( 0 ) ;
207188 expect ( result . stdout ) . toBe ( "1:test\n2:test\n" ) ;
208- expect ( result . stdout ) . not . toContain ( "file.txt" ) ;
209189 } ) ;
210190
211191 it ( "should NOT affect -l (files with matches)" , async ( ) => {
@@ -249,7 +229,6 @@ describe("rg -I with context lines", () => {
249229 const result = await bash . exec ( "rg -I -A1 match" ) ;
250230 expect ( result . exitCode ) . toBe ( 0 ) ;
251231 expect ( result . stdout ) . toBe ( "2:match\n3-after\n" ) ;
252- expect ( result . stdout ) . not . toContain ( "file.txt" ) ;
253232 } ) ;
254233
255234 it ( "should hide filename with -B (before context)" , async ( ) => {
@@ -262,7 +241,6 @@ describe("rg -I with context lines", () => {
262241 const result = await bash . exec ( "rg -I -B1 match" ) ;
263242 expect ( result . exitCode ) . toBe ( 0 ) ;
264243 expect ( result . stdout ) . toBe ( "1-before\n2:match\n" ) ;
265- expect ( result . stdout ) . not . toContain ( "file.txt" ) ;
266244 } ) ;
267245
268246 it ( "should hide filename with -C (context)" , async ( ) => {
@@ -275,7 +253,6 @@ describe("rg -I with context lines", () => {
275253 const result = await bash . exec ( "rg -I -C1 match" ) ;
276254 expect ( result . exitCode ) . toBe ( 0 ) ;
277255 expect ( result . stdout ) . toBe ( "2-b\n3:match\n4-c\n" ) ;
278- expect ( result . stdout ) . not . toContain ( "file.txt" ) ;
279256 } ) ;
280257
281258 it ( "should hide filename in context across multiple files" , async ( ) => {
@@ -286,11 +263,12 @@ describe("rg -I with context lines", () => {
286263 "/home/user/b.txt" : "ctx\nmatch\nctx\n" ,
287264 } ,
288265 } ) ;
289- const result = await bash . exec ( "rg -I -C1 match" ) ;
266+ const result = await bash . exec ( "rg -I -C1 --sort path match" ) ;
290267 expect ( result . exitCode ) . toBe ( 0 ) ;
291- expect ( result . stdout ) . not . toContain ( "a.txt" ) ;
292- expect ( result . stdout ) . not . toContain ( "b.txt" ) ;
293- expect ( result . stdout ) . toContain ( "match" ) ;
268+ // No separator between files when -I is used since there's no filename prefix
269+ expect ( result . stdout ) . toBe (
270+ "1-ctx\n2:match\n3-ctx\n1-ctx\n2:match\n3-ctx\n" ,
271+ ) ;
294272 } ) ;
295273} ) ;
296274
@@ -306,7 +284,6 @@ describe("rg -I with file filters", () => {
306284 const result = await bash . exec ( "rg -I -t js const" ) ;
307285 expect ( result . exitCode ) . toBe ( 0 ) ;
308286 expect ( result . stdout ) . toBe ( "1:const x = 1;\n" ) ;
309- expect ( result . stdout ) . not . toContain ( "code.js" ) ;
310287 } ) ;
311288
312289 it ( "should work with -g (glob filter)" , async ( ) => {
@@ -320,7 +297,6 @@ describe("rg -I with file filters", () => {
320297 const result = await bash . exec ( "rg -I -g '*.log' error" ) ;
321298 expect ( result . exitCode ) . toBe ( 0 ) ;
322299 expect ( result . stdout ) . toBe ( "1:error occurred\n" ) ;
323- expect ( result . stdout ) . not . toContain ( "test.log" ) ;
324300 } ) ;
325301} ) ;
326302
@@ -359,7 +335,6 @@ describe("rg -I edge cases", () => {
359335 const result = await bash . exec ( "rg -I --hidden secret" ) ;
360336 expect ( result . exitCode ) . toBe ( 0 ) ;
361337 expect ( result . stdout ) . toBe ( "1:secret\n" ) ;
362- expect ( result . stdout ) . not . toContain ( ".hidden" ) ;
363338 } ) ;
364339
365340 it ( "should work combined with other short flags" , async ( ) => {
@@ -373,7 +348,6 @@ describe("rg -I edge cases", () => {
373348 const result = await bash . exec ( "rg -Iin test" ) ;
374349 expect ( result . exitCode ) . toBe ( 0 ) ;
375350 expect ( result . stdout ) . toBe ( "1:Test\n2:test\n3:TEST\n" ) ;
376- expect ( result . stdout ) . not . toContain ( "file.txt" ) ;
377351 } ) ;
378352
379353 it ( "should output just line numbers with -In" , async ( ) => {
0 commit comments