foundry-rs / foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
https://getfoundry.sh
Apache License 2.0
7.94k stars 1.61k forks source link

feat(forge): compile only the test files matched via `--match-test` #5041

Closed PaulRBerg closed 3 months ago

PaulRBerg commented 1 year ago

Component

Forge

Describe the feature you would like

During development in large code bases, it it often useful to use the --match-test flag to zero in on specific tests. However, making one small change in src often leads to Forge recompiling all test files:

[⠒] Compiling 139 files with 0.8.19

This operation takes time (minutes) even with the optimizer disabled (and via IR disabled, too).

It would be helpful if Forge could exclude all test files not matched via --match-test (or --match-contract, or --match-path) from the compilation step.

Additional context

No response

PaulRBerg commented 10 months ago

How difficult would it be to support this feature?

Debugging anything in a large code base like Sablier V2 takes up to a minute. Basically, each time I add a new console.log2 in my src files, 100+ files get recompiled because most of our tests depend on some files in src.

klkvr commented 3 months ago

Solved by #7334