diff --git a/crytic_compile/cryticparser/cryticparser.py b/crytic_compile/cryticparser/cryticparser.py index f8848377..8b97f1c2 100755 --- a/crytic_compile/cryticparser/cryticparser.py +++ b/crytic_compile/cryticparser/cryticparser.py @@ -496,3 +496,11 @@ def _init_foundry(parser: ArgumentParser) -> None: dest="foundry_out_directory", default=DEFAULTS_FLAG_IN_CONFIG["foundry_out_directory"], ) + + group_foundry.add_argument( + "--foundry-dont-skip", + help='Do not add "--skip test script" flags', + action="store_true", + dest="foundry_dont_skip", + default=DEFAULTS_FLAG_IN_CONFIG["foundry_dont_skip"], + ) diff --git a/crytic_compile/cryticparser/defaults.py b/crytic_compile/cryticparser/defaults.py index fda8dc0a..b04ff494 100755 --- a/crytic_compile/cryticparser/defaults.py +++ b/crytic_compile/cryticparser/defaults.py @@ -45,6 +45,7 @@ "hardhat_artifacts_directory": None, "foundry_ignore_compile": False, "foundry_out_directory": "out", + "foundry_dont_skip": False, "export_dir": "crytic-export", "compile_libraries": None, } diff --git a/crytic_compile/platform/foundry.py b/crytic_compile/platform/foundry.py index f0d6c7f8..70c6424d 100755 --- a/crytic_compile/platform/foundry.py +++ b/crytic_compile/platform/foundry.py @@ -49,14 +49,23 @@ def compile(self, crytic_compile: "CryticCompile", **kwargs: str) -> None: ) if not ignore_compile: - run( - [ - "forge", - "build", - "--build-info", - ], - cwd=self._target, - ) + commands_to_run = [ + "forge", + "build", + "--build-info", + ] + + dont_skip = kwargs.get("foundry_dont_skip", False) + if not dont_skip: + # Adding flags to skip test/ and script/ directory + commands_to_run += [ + "--skip", + "*/test/**", + "*/script/**", + "--force", + ] + + run(commands_to_run, cwd=self._target) build_directory = Path( self._target,