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.

Async/await tests throwing `revert` error randomly

See original GitHub issue
  • [Y] I’ve asked for help in the Truffle Gitter before filing this issue.

Issue

The following error causes tests to fail randomly. Error: VM Exception while processing transaction: revert

Steps to Reproduce

It’s hard to reproduce although here’s a link to the repo: https://github.com/kermankohli/ethme

Expected Behavior

Tests should consistently pass all the time.

Actual Results

The same test will fail, and then pass when rerun again. It seems to be some kind of caching issue or race condition.

Environment

  • Operating System: Mac OSX
  • Ethereum client: Gananche
  • Truffle version (truffle version): 4.1.7
  • node version (node --version): 9.10.1
  • npm version (npm --version): 5.6.0

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
cgeweckecommented, May 9, 2018

@barakman Nice catch!!

1reaction
kermankohlicommented, Apr 26, 2018

Okay so gave that a go and the same 12 tests fail which is good since at leas there’s consistency in what’s not working. Although still not sure what exactly is going on here.

await new Promise(resolve => setTimeout(resolve, 1000)); worked instead 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jest test fails when trying to test an asynchronous function ...
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not...
Read more >
Async/Await - Best Practices in Asynchronous Programming
Async void methods have different error-handling semantics. When an exception is thrown out of an async Task or async Task<T> method, that exception...
Read more >
Ember test with async await functions not working as intended
Keep getting this message randomly. I am using ember-simple-auth with custom authenticator, which is pretty basic. Just sends login request to ...
Read more >
Why isn't this unit test catching an error from this async/await ...
It's an async function so we await it and expect it to eventually throw , since the function will throw a new Error...
Read more >
Understanding the Event Loop, Callbacks, Promises, and ...
A built-in API that you can test this with is setTimeout , which sets a ... callback) { // Throw an error if...
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