DeprecationWarning: expectEvent.inLogs() is deprecated

Hi all,

I'm using re-using the OZ ER721 test suite (ERC721.test.js, ERC721.behavior.js), and I'm getting the following output in my test results:

DeprecationWarning: expectEvent.inLogs() is deprecated. Use expectEvent() instead.

and the test passes.

However, when I remove .inLogs() the test fails with the following error:

Error: Unknown transaction receipt object
      at expectEvent (node_modules/@openzeppelin/test-helpers/src/expectEvent.js:31:11)
      at Context.<anonymous> (test/ERC721/ERC721.behavior.js:569:13)
      at runMicrotasks (<anonymous>)
      at processTicksAndRejections (internal/process/task_queues.js:93:5)

Wondering if anyone knows more about this, and how to remove the DeprecationWarning.


Hello @swaylock

First of all, I would like to state that the testing suite is for internal use, and we do not package it with our contracts. Of course your are free to use it for your project (I think its great practice).

  • expectEvent looks for events in a tx receipt
  • expectEvent.inLogs looks for in a receipts logs (so it doesn't take the same object as input)

Here is a version that doesn't have the deprecated warnings:

@Amxx, this worked perfectly. Thanks for sharing. Will you be PR'ing?