Ganache v7 and expectRevert @openzeppelin/test-helpers

Guys,
I use the package @openzeppelin/test-helpers in my tests. It works fine when I run on Ganache v2.5. However, I made a upgrade to Ganache v7.0.1 and now my tests fail.

I wonder if someone had the same experience and if there is some kind of upgrade to @openzeppelin/test-helpers in order to fit the changes in Ganache.

:1234: Code to reproduce

The test bellow passes when run on Ganache v2.5:

await expectRevert(
      gameContract.bet(score, betTokenAmount, {
        from: bettor,
      }),
      "ERC20: transfer amount exceeds allowance"
    );

After upgrading to Ganache v7.0.1 it's failing:

      Wrong kind of exception received
      + expected - actual

      -Transaction: 0x3dfa34902aaceb3fd6e7176180d65bc9c0b7ec664ddad54c5700ab2f42d6214c exited with an error (status 0). 
      -     Please check that the transaction:
      -     - satisfies all conditions set by Solidity `require` statements.
      -     - does not trigger a Solidity `revert` statement.
      +ERC20: transfer amount exceeds allowance

:computer: Environment

Truffle v5.4.29 (core: 5.4.29)
Solidity - 0.8.11 (solc-js)
Node v16.13.2
Web3.js v1.5.3

ganache v7.0.1 (@ganache/cli: 0.1.2, @ganache/core: 0.1.2)

@openzeppelin/test-helpers 0.5.15

The problem was solved when I update my Truffle to v5.4.31.

1 Like