Open RashInTech opened 11 months ago
Insteand of it("emits an event on enter", async function () { await expect(raffle.enterRaffle({ value: raffleEntranceFee })).to.emit( raffle, "raffleEnter", )
try this await expect(raffle.enterRaffle({ value: raffleEntranceFee }).to.eventually.equal(raffle);
Reason: It is because you are ether v6 as your main depedency, but hardhat-waffle has ether v5 as a dependency. So there is conflict between ether versions which creates the issue.
Solution : hardhat-waffle uses ether v5 as a depedency, even for the latest version. So if you want to use hardhat-waffle, downgrade to ether v5, downgrade the dependent packages as well.
But if you want to use ether v6 then use hardhat-toolbox and hardhat-chai-matchers instead of hardhat-waffle.
Lesson
Lesson 9
Could you please leave a link to the timestamp in the video where this error occurs? (You can right click a video and "copy video URL at current time")
No response
Operating System
Windows
Describe the bug
const { assert, expect } = require("chai")
const { network, deployments, ethers, getNamedAccounts } = require("hardhat") const { developmentChains, networkConfig } = require("../../helper-hardhat-config")
!developmentChains.includes(network.name) ? describe.skip : describe("Raffle Unit Tests", function () { let raffle, VRFCoordinatorV2Mock, raffleEntranceFee, deployer const chainId = network.config.chainId beforeEach(async function () { deployer = (await getNamedAccounts()).deployer await deployments.fixture(["all"]) raffle = await ethers.getContract("Raffle", deployer) VRFCoordinatorV2Mock = await ethers.getContract("VRFCoordinatorV2Mock", deployer) raffleEntranceFee = await raffle.getEntranceFee() })
I am getting TypeError: Cannot read properties of undefined (reading 'waitForTransaction') when emitting my event.Can anyone fix this?