PatrickAlphaC / hardhat-fund-me-fcc

82 stars 183 forks source link

Update "revertedWith" to "revertedWithCustomError" #53

Closed MozharAlhosni closed 2 years ago

MozharAlhosni commented 2 years ago

The latest Hardhat Chai Matchers plugin provides the new matcher "revertedWithCustomError" in case a custom error is used in the contract. The test will no longer pass if "revertedWith" is used with a string while in the contract a custom error is used, as hardhat will output the following error:"AssertionError: Expected transaction to be reverted with reason 'FundMe__NotOwner', but it reverted with a custom error".

MozharAlhosni commented 2 years ago

I will close this PR as I have forgotten that this is only applicable if "@nomicfoundation/hardhat-chai-matchers" is used in the config of hardhat, and not what the video has used.