smartcontractkit / full-blockchain-solidity-course-js

Learn Blockchain, Solidity, and Full Stack Web3 Development with Javascript
11.94k stars 2.89k forks source link

About the problem in Lesson 9, "Error: Timeout of 20000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. " #6473

Open RMTKroos opened 4 months ago

RMTKroos commented 4 months ago

If using ethers v6,some changes are needed. Firstly, in ethers v6, getBalance function need use provider, Change:

const winnerStartingBalance = await accounts[0].getBalance()

To:

const winnerStartingBalance = await ethers.provider.getBalance(accounts[1].address)

furthermore, in v6, the BigNumber class has been replaced with the built-in ES2020, Change:

winnerStartingBalance.add(raffleEntryFee)

To:

winnerStartingBalance + raffleEntryFee

Originally posted by @RMTKroos in https://github.com/smartcontractkit/full-blockchain-solidity-course-js/discussions/5050#discussioncomment-8631051

NIAZELOPER commented 2 months ago

Remove this from your hardhat.config.js:

mocha: { timeout: 20000, },