Starting to build the following test suite for a contract. It deploys fine on Remix.
I get the following error message.
1) "before each" hook for "deploys a contract": Error: Timeout of 20000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
I haven't had much of an issue doing this on other contracts with this setup. Not sure what's going on here. Am I missing something basic?
const assert = require('assert');
const ganache = require('ganache-cli');
const Web3 = require('web3');
const web3 = new Web3(ganache.provider());
const json = require('../build/contracts/Contract.json');
let accounts, contract;
const NULL_ADDRESS = "0x0000000000000000000000000000000000000000";
beforeEach( async () => {
// Get a list of all accounts;
accounts = await web3.eth.getAccounts();
console.log('accounts', accounts);
const interface = json["abi"];
contract = await new web3.eth.Contract(interface)
.deploy({ data: json["bytecode"] })
.send({ from: accounts[0], gas: '3000000' })
console.log('contract', contract);
});
describe("Contract", () => {
describe("Smoke test", () => {
it("deploys a contract", async () => {
await assert.ok(contract.options.address);
});
})
});
json[bytecode]
.enableTimeouts
configuration flag, which you can set tofalse
. BTW, no need forawait
on thatassert
.