-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Forge compiles all test contracts when specified to only use one contract. #2066
Comments
I see, filtering before we compile is not that trivial because of dependencies that may be in conflict with the filter. But I guess for test contracts it shouldn't be that problematic since those usually only inherit. this is the first time this came up, so have to think about if support for this scenario is worth adding. a current workaround would be to use two test folders and two profiles so you can test separately via |
Awesome! Feel free to close this issue if you decide that support won't be added. Would be good to add this to the foundry book if anyone has a similar issue. |
Related to sparse mode which had some bugs |
same trouble, is there any better solution rather set two folder? |
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (935c113 2022-06-22T00:14:50.974796Z)
What command(s) is the bug in?
forge test --match-contract <CONTRACT_NAME>
Operating System
macOS (Apple Silicon)
Describe the bug
I'm not sure if this is intended behavior or not but would be nice if when using
forge test --match-contract <CONTRACT_NAME>
the only test contract that is compiled is the contract mentioned and all the necessary imports.This is how the situation unfolded for me:
I made a change in a function in contract
A.sol
and I have two test contractsBTest.sol
andCTest.sol
both with tests using that function, I'm aware that tests in contractCTest.sol
will fail to compile so I wanted to only test contractBTest.sol
. Because forge compiles all contracts at the same time I'm unable to testBTest.sol
without fixingCTest.sol
.The text was updated successfully, but these errors were encountered: