Skip to content
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

feat(forge test): add --skip flag for forge test to skip compilation of specific files or folders #9164

Closed
wjorgensen opened this issue Oct 23, 2024 · 4 comments
Labels
C-forge Command: forge Cmd-forge-test Command: forge test T-feature Type: feature

Comments

@wjorgensen
Copy link

Component

Forge

Describe the feature you would like

There is a skip flag for forge build but no skip flag for forge test when it builds the project. I want to be able to skip compilation of non essential files when I'm only testing one specific file or function. In addition to a general skip flag when I use the --match-contract and --match-test flags there should be a flag to only compile the files that are used by the contract or test.

Desired behavior

forge test --skip /script

Skips the compilation of all files in the script folder

forge test --match-contract Test1 --skip

Only compiles files imported and used within the Test1 contract.

Additional context

For context why I am asking for this feature is because I am building a tool called Solidings which is a version of Rustlings but for solidity. I'm trying to use foundry tests to check for completion of files but I can't run forge test because it compiles all of the files in the project every time it runs even when I'm running --match-contract or --match-test. This means that for forge test to be able to run the user must complete all of the files in the entire project. This doesn't work because just like Rustlings I would like for the user to be able to check each file as the complete them.

@wjorgensen wjorgensen added T-feature Type: feature T-needs-triage Type: this issue needs to be labelled labels Oct 23, 2024
@github-project-automation github-project-automation bot moved this to Todo in Foundry Oct 23, 2024
@zerosnacks zerosnacks changed the title --skip flag for forge test to skip compilation of specific files or folders feat(forge test): add --skip flag for forge test to skip compilation of specific files or folders Oct 23, 2024
@zerosnacks zerosnacks added Cmd-forge-test Command: forge test C-forge Command: forge and removed T-needs-triage Type: this issue needs to be labelled labels Oct 23, 2024
@zerosnacks
Copy link
Member

Related: foundry-rs/compilers#197

@cuiweixie
Copy link
Contributor

If this feature is accept, can I try to develop this feature.

@klkvr
Copy link
Member

klkvr commented Oct 25, 2024

I believe this should already work like this. Right now forge test would only compiled filtered test files. And --skip is also available

ref #7334

@klkvr
Copy link
Member

klkvr commented Oct 27, 2024

Closing for now, please open a new issue if anything of the above is not working correctly

@klkvr klkvr closed this as completed Oct 27, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in Foundry Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-forge Command: forge Cmd-forge-test Command: forge test T-feature Type: feature
Projects
Status: Done
Development

No branches or pull requests

5 participants
@cuiweixie @klkvr @wjorgensen @zerosnacks and others