Ask coding questions

← Back to all posts
2
Timeout 2s when running mocha test on Node.js application for Ethereum Dapp using web3.js
divyanshugupta (1)

Node.js and Mocha Beginner
https://repl.it/@divyanshugupta/EthereumApp
In this repl I''m building an ethereum dapp which makes use of web3.js (v 1.0.0-beta.26)
I'm using web3.eth.getAccounts() and web3.eth.Contract().deploy.send() both of which are asynchronous and return promises.
The tests were working with till I was using only web3.eth.getAccounts() but started failing when I added the web3.eth.Contract().deploy.send()
I have used async and await to ensure the promises are resolved yet on running the index.js, mocha says that Timeout 2s exceeded. async test and hooks must be return done(); if promises are returned then ensure they are resolved.

The tests are written inside 'test/Inbox.test.js' and test script is set to : scripts : { test : "mocha"}