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:
- Created 5 years ago
- Comments:30 (14 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@barakman Nice catch!!
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 😉