hashgraph / hedera-hardhat-hethers

DEPRECATED Hardhat plugin for integration with hethers.js.
Apache License 2.0
6 stars 0 forks source link

chai expect to be revertedWith does not work #31

Closed mshakeg closed 1 year ago

mshakeg commented 2 years ago

Problem

The error with which a contract call reverts can be tested positively as follows:

import { expect } from "chai";

  await expect(
    contract.foo(-1)
  ).to.be.revertedWith("OUT_OF_RANGE");

If the contract reverts with another error an AssertionError like the following is normally in hardhat:

AssertionError: Expected transaction to be reverted with OUT_OF_RANGE, but other exception was thrown: Error: VM Exception while processing transaction: reverted with custom error 'OutOfRange()'

The response from a contract call that reverted using @hashgraph/hardhat-hethers does not have parity with the default hardhat functionality and instead throws the follows AssertionError:

AssertionError: Expected transaction to be reverted with OUT_OF_RANGE, but other exception was thrown: Error: receipt for transaction 0.0.1002@1661713061.964268246 contained error status CONTRACT_REVERT_EXECUTED (code=CONTRACT_REVERT_EXECUTED, version=providers/1.2.0)

Solution

Alternatives

No response

mshakeg commented 1 year ago

Should work now with developer mode