question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AssertionError when an event is emitted

See original GitHub issue

Hi!

Firstly, thanks for this incredibly useful library. It makes my whole testing flow that much more manageable.

I’m running into an issue where the an AssertionError: Event filter for <eventName> returned no results is thrown, when, whilst running the tests, the output is

Events emitted during test:
    ---------------------------
    eventName([args])
    ---------------------------

Is this a bug?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
hdahmecommented, Jun 14, 2018

Ohhh… got it.

If I use

truffleAssert.eventEmitted(tx, 'TestEvent', (ev) => {
        return ev.i == 1;
    });

instead of

truffleAssert.eventEmitted(tx, 'TestEvent', (ev) => {
        return ev.i === 1;
    });

it passes.

Thanks for this awesome library =)

0reactions
ghostcommented, Jul 21, 2020

you can do return ev.i.toNumber() === 1; and it’ll work

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use truffle-assertions to verify parameters of an emit?
This is the emit I am trying to test: event ... It fails with the error AssertionError: Event filter for Transfer returned no...
Read more >
AssertionError: Specified args not emitted - Solidity Hardhat
I have a smart contract that I'm testing the first functions of, and so far everything seems fine apart from one argument of...
Read more >
Events not emitted during tests - OpenZeppelin Forum
Unfortunately, during testing I'm always getting AssertionError: Expected event "Deposited" to be emitted, but it wasn't Also the Withdrawn ...
Read more >
Node.js v19.3.0 Documentation
If the values are not strictly equal, an AssertionError is thrown with a message property set equal to the value of the message...
Read more >
Errors | Node.js v18 API
AssertionError s are a special class of error that can be triggered when Node.js ... onLine (node:repl:902:10) // at REPLServer.emit (node:events:549:35) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found