AssertionError: Expected transaction to be reverted with reason 'Raffle__NotEnoughEthEntered', but it reverted with a custom error #2702
-
I'm writing a test that requires enterRaffle() to be reverted with MyCustomError - "Raffle__NotEnoughEthEntered" describe("enterRaffle", async function () {
it("reverts when you don't pay enough", async function () {
await expect(raffle.enterRaffle()).to.be.revertedWith(
"Raffle__NotEnoughEthEntered"
)
})
}) The test fails with error; 1) Raffle
enterRaffle
reverts when you don't pay enough:
AssertionError: Expected transaction to be reverted with reason 'Raffle__NotEnoughEthEntered', but it reverted with a custom error
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at Context.<anonymous> (test/unit/Raffle.test.js:32:19) Why is Raffle__NotEnoughEthEntered not a custom error? I have read other similar issues but they don't solve my problem. Raffle.sol
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 13 replies
-
@kihiuFrank try this |
Beta Was this translation helpful? Give feedback.
-
Hey @kihiuFrank try and use
|
Beta Was this translation helpful? Give feedback.
Hey @kihiuFrank try and use
to.be.revertedWithCustomError()
instead and see if it works.The line should read something like this