foundry icon indicating copy to clipboard operation
foundry copied to clipboard

bug: combination of `vm.expectRevert` and (failing) `deployCode` does not work

Open fubhy opened this issue 1 year ago • 1 comments

Component

Forge

Describe the feature you would like

It's currently not possible to pair a deployCode with vm.expectRevert. It also doesn't work to use testFail in this case.

We are forced to use deployCode to get around version constraints (our tests are solc 0.8.17 and some of our code is 0.6.12). We'd like to test some validation constraints in the constructor of one of our (old) contracts.

Additional context

One workaround would be to create a mock factory contract and use deployCode on that one and then deploy the tested contract through that mock factory ... but that seems a bit unwieldy.

fubhy avatar Mar 17 '23 11:03 fubhy