You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Being able to provide a flag to forge test command that turns off fork reset for every test. E.g. forge test --preserve-fork-state
Additional context
Thanks for the great project, we love the execution speed and the possibility to write concise solidity-based tests.
But according to the docs, the blockchain state is being reset between the tests, and it's not possible to overwrite this behaviour (via, let's say --preserve-state flag). The reason it will be helpful: to reuse solidity test code for other purposes.
Simple use-case: after executing one specific test the user connects to the (still running) anvil fork via RPC and validates something by hand. Useful for debugging frontend
Complex use-case: run hardhat tests on top of the state changes produced by the solidity test. Useful when execution parameters coming off-chain (i.e. routing data)
One other possible implementation of the same functionality would be via cheat codes that work inside anvil fork, but outside tests. E.g. a user deploys t.sol contract, then executes specific "test" function via RPC to reach desired state. There is no documentation on this, but according to our trials cheat codes don't work outside tests (i.e. when ran by foundry test)
Please let me know what you think about this functionality and if we're using it wrong!
The text was updated successfully, but these errors were encountered:
Component
Forge
Describe the feature you would like
Being able to provide a flag to
forge test
command that turns off fork reset for every test. E.g.forge test --preserve-fork-state
Additional context
Thanks for the great project, we love the execution speed and the possibility to write concise solidity-based tests.
But according to the docs, the blockchain state is being reset between the tests, and it's not possible to overwrite this behaviour (via, let's say
--preserve-state
flag). The reason it will be helpful: to reuse solidity test code for other purposes.One other possible implementation of the same functionality would be via cheat codes that work inside anvil fork, but outside tests. E.g. a user deploys
t.sol
contract, then executes specific "test" function via RPC to reach desired state. There is no documentation on this, but according to our trials cheat codes don't work outside tests (i.e. when ran byfoundry test
)Please let me know what you think about this functionality and if we're using it wrong!
The text was updated successfully, but these errors were encountered: