Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Only compile one file and test it #9163

Unanswered
wjorgensen asked this question in Help
Discussion options

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.

You must be logged in to vote

Replies: 1 comment

Comment options

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
You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /