-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Only compile one file and test it #9163
-
I'm building a version of rustlings for solidity called solidings. To check for completion of the individual files I wanted to run foundry tests. The problem with that is when forge test is run it builds the entire project and since there will be other files that don't compile the build fails. Is there a way to only compile a specific file and test and run the test without building the whole project? The only way I can think of right now is to have a whole separate foundry project for every file which would make the project massive.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
I usually put the source files and test files in the same directory (e.g., src/foo/foo.sol and src/foo/foo.t.sol), and then temporarily specify that directory (src/foo) as src in foundry.toml.
[profile.default]
src = "src/foo"
also, I run the command to ignore the temporary foundry.toml update:
git update-index --skip-worktree foundry.toml
Beta Was this translation helpful? Give feedback.