@@ -240,3 +240,98 @@ fn test_invalid_report() -> Result<(), Box<dyn std::error::Error>> {
240240
241241 Ok ( ( ) )
242242}
243+
244+ #[ test]
245+ fn test_exclude_glob ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
246+ let mut cmd = Command :: cargo_bin ( "split-test" ) ?;
247+
248+ // Test excluding specific files - should include a_test.rb and c_test.rb, exclude b_test.rb
249+ cmd. current_dir ( "tests/fixtures/minitest" )
250+ . arg ( "--junit-xml-report-dir" )
251+ . arg ( "report" )
252+ . arg ( "--node-index" )
253+ . arg ( "0" )
254+ . arg ( "--node-total" )
255+ . arg ( "1" )
256+ . arg ( "--tests-glob" )
257+ . arg ( "*_test.rb" )
258+ . arg ( "--tests-exclude-glob" )
259+ . arg ( "b_test.rb" ) ;
260+
261+ cmd. assert ( )
262+ . success ( )
263+ . stdout ( predicate:: str:: contains ( "a_test.rb" ) )
264+ . stdout ( predicate:: str:: contains ( "b_test.rb" ) . not ( ) )
265+ . stdout ( predicate:: str:: contains ( "c_test.rb" ) )
266+ . stderr ( predicate:: str:: is_empty ( ) ) ;
267+
268+ // Test excluding with wildcard - exclude all files starting with 'a'
269+ cmd = Command :: cargo_bin ( "split-test" ) ?;
270+
271+ cmd. current_dir ( "tests/fixtures/minitest" )
272+ . arg ( "--junit-xml-report-dir" )
273+ . arg ( "report" )
274+ . arg ( "--node-index" )
275+ . arg ( "0" )
276+ . arg ( "--node-total" )
277+ . arg ( "1" )
278+ . arg ( "--tests-glob" )
279+ . arg ( "*_test.rb" )
280+ . arg ( "--tests-exclude-glob" )
281+ . arg ( "a*_test.rb" ) ;
282+
283+ cmd. assert ( )
284+ . success ( )
285+ . stdout ( predicate:: str:: contains ( "a_test.rb" ) . not ( ) )
286+ . stdout ( predicate:: str:: contains ( "b_test.rb" ) )
287+ . stdout ( predicate:: str:: contains ( "c_test.rb" ) )
288+ . stderr ( predicate:: str:: is_empty ( ) ) ;
289+
290+ // Test with split across nodes and exclude
291+ cmd = Command :: cargo_bin ( "split-test" ) ?;
292+
293+ cmd. current_dir ( "tests/fixtures/minitest" )
294+ . arg ( "--junit-xml-report-dir" )
295+ . arg ( "report" )
296+ . arg ( "--node-index" )
297+ . arg ( "0" )
298+ . arg ( "--node-total" )
299+ . arg ( "2" )
300+ . arg ( "--tests-glob" )
301+ . arg ( "*_test.rb" )
302+ . arg ( "--tests-exclude-glob" )
303+ . arg ( "c_test.rb" ) ;
304+
305+ cmd. assert ( )
306+ . success ( )
307+ . stdout ( predicate:: str:: contains ( "a_test.rb" ) )
308+ . stdout ( predicate:: str:: contains ( "b_test.rb" ) . not ( ) )
309+ . stdout ( predicate:: str:: contains ( "c_test.rb" ) . not ( ) )
310+ . stderr ( predicate:: str:: is_empty ( ) ) ;
311+
312+ // Test with multiple exclude patterns - exclude both a_test.rb and c_test.rb
313+ cmd = Command :: cargo_bin ( "split-test" ) ?;
314+
315+ cmd. current_dir ( "tests/fixtures/minitest" )
316+ . arg ( "--junit-xml-report-dir" )
317+ . arg ( "report" )
318+ . arg ( "--node-index" )
319+ . arg ( "0" )
320+ . arg ( "--node-total" )
321+ . arg ( "1" )
322+ . arg ( "--tests-glob" )
323+ . arg ( "*_test.rb" )
324+ . arg ( "--tests-exclude-glob" )
325+ . arg ( "a_test.rb" )
326+ . arg ( "--tests-exclude-glob" )
327+ . arg ( "c_test.rb" ) ;
328+
329+ cmd. assert ( )
330+ . success ( )
331+ . stdout ( predicate:: str:: contains ( "a_test.rb" ) . not ( ) )
332+ . stdout ( predicate:: str:: contains ( "b_test.rb" ) )
333+ . stdout ( predicate:: str:: contains ( "c_test.rb" ) . not ( ) )
334+ . stderr ( predicate:: str:: is_empty ( ) ) ;
335+
336+ Ok ( ( ) )
337+ }
0 commit comments