Tutorial - 5. Testing contracts #3968
Replies: 2 comments 3 replies
-
Hi @ridhof, the reason why ethers is not installed explicitly is that you install the Hardhat toolbox, which has ethers as a peer dependency. npm, starting from version 7, installs peer dependencies automatically. If you are using yarn or an older version of npm, then you do have to install everything manually. Hardhat docs have tabs to select the package manager you are using: If you select |
Beta Was this translation helpful? Give feedback.
-
how do I downgrade my chain in npm its currently sitting in a mocha test project but how do I change the current chai version to something older? |
Beta Was this translation helpful? Give feedback.
-
Hi, I was following the tutorial here, https://hardhat.org/tutorial/testing-contracts.
I was a bit confused when its informed that the test are going to use ethers.js and Mocha, but there is no npm install instruction like the previous page.
and then I installed ethers with
npm i --save-dev ethers
.and then I tried to install mocha with
npm i --save-dev mocha
but then I got this error logand then I checked my
package-lock.json
and I found mocha is already installed there.Installing ethers is also include mocha installation, I assume.
and then, I run the
npx hardhat test
, and I got this error:I am assuming that the
ethers
are not imported properly or something, but I found the same issue posted in here https://ethereum.stackexchange.com/questions/144451/typeerror-cannot-read-properties-of-undefined-reading-jsonrpcprovider.Following the solution, I tried to downgrade, and then its successfully run the test.
I think it will be great if the tutorial could also include the installation sample to be consistent like the previous chapter.
and also I think it will be great if including the ether.js version that is working.
Beta Was this translation helpful? Give feedback.
All reactions