foundry icon indicating copy to clipboard operation
foundry copied to clipboard

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

Open PaulRBerg opened this issue 3 years ago • 1 comments

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 avatar Dec 06 '22 13:12 PaulRBerg

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"

PaulRBerg avatar Jan 21 '23 12:01 PaulRBerg

closing as not planned in favour of --no-match-path . Thanks

grandizzy avatar Mar 19 '25 16:03 grandizzy