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
8.16k stars 1.7k forks source link

Feature request: make the "test" config a glob patter rather than a directory #3841

Open PaulRBerg opened 1 year ago

PaulRBerg commented 1 year ago

Component

Forge

Describe the feature you would like

The test property in the Foundry config is currently a simple path to a directory. My request is turn it into a glob pattern to enable selective exclusion of certain paths (e.g. fork tests), though there may be multiple use cases depending upon each user's situation.

Take the following directory structure:

test
├── e2e
├── integration
└── unit

It is not currently possible to make Forge run the tests only in the integration and unit directories, but this is useful in a non-CI environment. It is only possible to run the tests in either the integration and the unit. The following configuration doesn't work:

test = "test/{integration,unit}"

Adding support for glob patterns should be easy, because there wouldn't be any breaking change. A simple directory path is still a glob pattern.

PaulRBerg commented 1 year ago

As a solution in the interim, it looks like we could use the --no-match-path flag:

$ forge test --no-match-path "test/e2e/**/*.sol"