Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Foundry --skip test script by default #466

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions crytic_compile/cryticparser/cryticparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
)
1 change: 1 addition & 0 deletions crytic_compile/cryticparser/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
25 changes: 17 additions & 8 deletions crytic_compile/platform/foundry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down