Is your feature request related to a problem? Please describe.
We were getting an unable to generate smock spec from string error when trying to construct a fake from an interface contract. It wasn't directly clear from smock what the issue was. In our case, we found the root cause to be that there were two different IERC20 artifacts in the repo -- which breaks getContractFactory. See hardhat error: multiple artifacts for a contract issue
Describe the solution you'd like
We should probably surface errors when parsing the spec string
Solution A: Log out caught errors (probably not ideal because we rely optional catch binding to parse spec)
Solution B: Store caught errors and log them if all tries fail
Is your feature request related to a problem? Please describe. We were getting an
unable to generate smock spec from string
error when trying to construct a fake from an interface contract. It wasn't directly clear from smock what the issue was. In our case, we found the root cause to be that there were two different IERC20 artifacts in the repo -- which breaksgetContractFactory
. See hardhat error: multiple artifacts for a contract issueDescribe the solution you'd like We should probably surface errors when parsing the
spec
stringspec
)Additional context https://github.com/defi-wonderland/smock/blob/d6397b7ed3b414395f43a97f697ef22fb46054a2/src/factories/ethers-interface.ts#L6-L19