crytic-compile icon indicating copy to clipboard operation
crytic-compile copied to clipboard

--skip '*/test/**' for forge is error prone if the project exists in a file path that contains a directory named 'test'

Open stong opened this issue 7 months ago • 2 comments

crytic-compile uses forge build --skip */test/** */script/** --force which is error prone and causes problems if the project exists in a path where any parent directory is named 'test'

To repro:

mkdir test
cd test
mkdir middle # this is optional
cd middle # optional
forge init asdf
cd asdf
forge clean
forge build --skip */test/** --force

This will result in forge thinking there is nothing to compile because */test/** is matching 'test/', so 'test/middle/asdf/' as well which includes the entire project

stong avatar May 28 '25 05:05 stong

Hi! yes, this is a known issue; unfortunately Foundry applies these rules on the full absolute paths instead of on the relative paths to the project repository only.

They seem to have added a new syntax to do relative matches now so maybe we should switch to using that. Could you confirm if something like --skip ./**/test/** works as expected?

elopez avatar May 28 '25 11:05 elopez

@stong PR #606 should hopefully address this

elopez avatar Jul 02 '25 19:07 elopez