@@ -18,7 +18,7 @@ use foundry_evm::{
1818 Env ,
1919 backend:: Backend ,
2020 decode:: RevertDecoder ,
21- executors:: { Executor , ExecutorBuilder } ,
21+ executors:: { Executor , ExecutorBuilder , FailFast } ,
2222 fork:: CreateFork ,
2323 inspectors:: CheatsConfig ,
2424 opts:: EvmOpts ,
@@ -296,6 +296,8 @@ pub struct TestRunnerConfig {
296296 pub isolation : bool ,
297297 /// Whether to enable Odyssey features.
298298 pub odyssey : bool ,
299+ /// Whether to exit early on test failure.
300+ pub fail_fast : FailFast ,
299301}
300302
301303impl TestRunnerConfig {
@@ -404,6 +406,8 @@ pub struct MultiContractRunnerBuilder {
404406 pub isolation : bool ,
405407 /// Whether to enable Odyssey features.
406408 pub odyssey : bool ,
409+ /// Whether to exit early on test failure.
410+ pub fail_fast : bool ,
407411}
408412
409413impl MultiContractRunnerBuilder {
@@ -419,6 +423,7 @@ impl MultiContractRunnerBuilder {
419423 isolation : Default :: default ( ) ,
420424 decode_internal : Default :: default ( ) ,
421425 odyssey : Default :: default ( ) ,
426+ fail_fast : false ,
422427 }
423428 }
424429
@@ -457,6 +462,11 @@ impl MultiContractRunnerBuilder {
457462 self
458463 }
459464
465+ pub fn fail_fast ( mut self , fail_fast : bool ) -> Self {
466+ self . fail_fast = fail_fast;
467+ self
468+ }
469+
460470 pub fn enable_isolation ( mut self , enable : bool ) -> Self {
461471 self . isolation = enable;
462472 self
@@ -538,15 +548,14 @@ impl MultiContractRunnerBuilder {
538548 env,
539549 spec_id : self . evm_spec . unwrap_or_else ( || self . config . evm_spec_id ( ) ) ,
540550 sender : self . sender . unwrap_or ( self . config . sender ) ,
541-
542551 line_coverage : self . line_coverage ,
543552 debug : self . debug ,
544553 decode_internal : self . decode_internal ,
545554 inline_config : Arc :: new ( InlineConfig :: new_parsed ( output, & self . config ) ?) ,
546555 isolation : self . isolation ,
547556 odyssey : self . odyssey ,
548-
549557 config : self . config ,
558+ fail_fast : FailFast :: new ( self . fail_fast ) ,
550559 } ,
551560 } )
552561 }
0 commit comments