TrueFiEng / Waffle

Library for writing and testing smart contracts.
https://getwaffle.io
MIT License
961 stars 162 forks source link

`.not.be.reverted` matcher invalidates any prior `.to.emit` matchers #747

Closed rslobodian closed 2 years ago

rslobodian commented 2 years ago

Example of a test that should fail but passes:

image image

it should be obvious but in my example above some inexistent event is not a valid event that my contract throws. By appending the .and.not.be.reverted matcher it seems like it completely invalidates the prior emit matcher.

If I remove the and.not.be.reverted from that test, I get the expected test failure.

rzadp commented 2 years ago

@rslobodian Thanks for the report, which version of Waffle do you have, and are you using Ganache or Hardhat with it?

rslobodian commented 2 years ago

I'm using waffle v3.4.4 with Hardhat and typescript

  "devDependencies": {
    "@nomiclabs/hardhat-waffle": "^2.0.3",
    // ...
    "@types/chai": "^4.3.1",
    "@types/chai-as-promised": "^7.1.5",
    "@types/mocha": "^9.1.1",
    // ...
    "chai": "^4.3.6",
    "chai-as-promised": "^7.1.1",
    // ...
    "ethereum-waffle": "^3.4.4",
    // ...
    "hardhat": "^2.9.3",
    // ...
  }
rzadp commented 2 years ago

@rslobodian We have an alpha version of Waffle 4, where we try to nail down those issues. You might want to try out the @alpha tag.

rslobodian commented 2 years ago

Do you guys have an ETA on when the RC of v4 will come out? I'd prefer not to use the alpha.

rzadp commented 2 years ago

Do you guys have an ETA on when the RC of v4 will come out? I'd prefer not to use the alpha.

Don't want to make promises, but I'm thinking next month.

rzadp commented 2 years ago

Waffle version 4 is out 🎉