Getting Error while running tests "TypeError: Cannot read properties of undefined (reading 'JsonRpcProvider')"
usaamatahir opened this issue · comments
I'm working on fundme and its deploying well on localhost but when I run test it gives me error
1) FundMe "before each" hook for "sets the aggregator addresses correctly": TypeError: Cannot read properties of undefined (reading 'JsonRpcProvider')
Here is the repo link
https://github.com/usaamatahir/fundme-hardhat
Here is the Code for test
`const { assert } = require("chai");
const { deployments, ethers, getNamedAccounts } = require("hardhat");
describe("FundMe", async function () {
let fundMe;
let deployer;
let MockV3Aggregator;
beforeEach(async function () {
deployer = (await getNamedAccounts()).deployer;
await deployments.fixture(["all"]);
fundMe = await ethers.getContract("FundMe", deployer);
MockV3Aggregator = await ethers.getContract(
"MockV3Aggregator",
deployer
);
});
describe("constructor", async function () {
it("sets the aggregator addresses correctly", async function () {
const response = await fundMe.getPriceFeed();
assert.equal(response, MockV3Aggregator.address);
});
});
});
`
getting same error.. trying to solve for two days.
getting same error.. trying to solve for two days.
Please post here if you find any solution. I'll do the same. Thanks
getting same error.. trying to solve for two days.
Please post here if you find any solution. I'll do the same. Thanks
sure
I have resolved this by install specific version of ethers@5.0.0 and importing @nomiclabs/hardhat-ethers in hardhat.config.ts