11use super :: { install, test:: filter:: ProjectPathsAwareFilter , watch:: WatchArgs } ;
22use alloy_primitives:: U256 ;
3- use clap:: Parser ;
3+ use clap:: { Parser , ValueHint } ;
44use eyre:: Result ;
55use forge:: {
66 decode:: decode_console_logs,
@@ -32,6 +32,7 @@ use foundry_config::{
3232 value:: { Dict , Map } ,
3333 Metadata , Profile , Provider ,
3434 } ,
35+ filter:: GlobMatcher ,
3536 get_available_profiles, Config ,
3637} ;
3738use foundry_debugger:: Debugger ;
@@ -58,6 +59,10 @@ foundry_config::merge_impl_figment_convert!(TestArgs, opts, evm_opts);
5859#[ derive( Clone , Debug , Parser ) ]
5960#[ command( next_help_heading = "Test options" ) ]
6061pub struct TestArgs {
62+ /// The contract file you want to test, it's a shortcut for --match-path.
63+ #[ arg( value_hint = ValueHint :: FilePath ) ]
64+ pub path : Option < GlobMatcher > ,
65+
6166 /// Run a test in the debugger.
6267 ///
6368 /// The argument passed to this flag is the name of the test function you want to run, and it
@@ -634,6 +639,13 @@ impl TestArgs {
634639 if self . rerun {
635640 filter. test_pattern = last_run_failures ( config) ;
636641 }
642+ if filter. path_pattern . is_some ( ) {
643+ if self . path . is_some ( ) {
644+ panic ! ( "Can not supply both --match-path and |path|" ) ;
645+ }
646+ } else {
647+ filter. path_pattern = self . path . clone ( ) ;
648+ }
637649 filter. merge_with_config ( config)
638650 }
639651
0 commit comments