sorry for a newbie question. I have a file from my study with the following code:

const { expect, assert } = require("chai");
const { ethers } = require("hardhat");
const { impersonateFundErc20 } = require("../utils/utilities");

const {
} = require("../artifacts/contracts/interfaces/IERC20.sol/IERC20.json");

const provider = waffle.provider;

Everything worked first, but after installing new Hardhat I saw a message about migrating from Waffle to Hardhat Chai Matchers. I've done everything from hardhat documentation. But without Waffle I'm receiving an error:

ReferenceError: waffle is not defined

If I install waffle back hardhat tells that there is a conflict. Is there any way to use this Chai Matchers or I need to install everything as it was 2 months ago with an older Hardhat and Waffles? Thanks and sorry again)


2 Answers 2


Try to change your line

const { ethers } = require("hardhat");


const { ethers, waffle } = require("hardhat");

and try again

Link to doc


instead of waffle.provider; try ethers.provider;

then run the test. it worked for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.