chai is not working #6453
Replies: 2 comments 3 replies
-
|
When we started this project unlike from the previous one we did not opt for a default hardhatConfig file that comes with certain packages already installed such as hard-toolbox which comes with most of the packages needed. This tutorial was from two years back when hardhat toolbox was not yet a thing, the default hardhatConfig comes hardhat-toolbox which will help us manage the chai-matchers package. So instead of downloading all the packages using the method suggested in the tutorial you can open a new directory start a new hardhat project and opt for the boilerplate hardhatConfig file then copy all your code to the new directory using the same paths. |
Beta Was this translation helpful? Give feedback.
-
|
Just change the version of chai to |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
i am getting this error while running unit test of raffle.sol
here is my test file
const { network, deployments, ethers } = require("hardhat") const { assert, expect } = require("chai") const { developmentChains, networkConfig } = require("../../helper-hardhat-config") describe("Raffle unit test", async function () { let raffle, vrfCoordinatorV2, raffleEntranceFee const chainId = network.config.chainId beforeEach(async function () { accounts = await ethers.getSigners() const player = accounts[0] await deployments.fixture(["all", "Raffle"]) const raffleContract = await ethers.getContract("Raffle") raffle = raffleContract.connect(player) vrfCoordinatorV2 = await ethers.getContract("VRFCoordinatorV2Mock") raffleEntranceFee = raffle.getEntranceFee() }) describe("constructor", async function () { it("initializes the Raffle Correctly", async function () { const raffleState = (await raffle.getRaffleState()).toString() const interval = await raffle.getInterval() assert.equal(raffleState, "0") assert.equal(interval.toString(), networkConfig[chainId]["interval"]) }) }) describe("enterRaffle", async function () { it("reverts when you dont pay enough", async function () { await expect(raffle.enterRaffle()).to.be.revertedWith(Raffle__NotEnoughEthEntered()) }) it("records player when they entered", async function () { await raffle.enterRaffle({ value: raffleEntranceFee }) const playerFromContract = await raffle.getPlayer(0) assert.equal(playerFromContract, deployer) }) }) })Beta Was this translation helpful? Give feedback.
All reactions