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".
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.
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".