#Migrating from Waffle
If you want to replace Waffle with Hardhat Chai Matchers, we recommend you migrate to the Hardhat Toolbox. If for some reason you want to migrate without using the Toolbox, read on.
# How to migrate
The @nomicfoundation/hardhat-chai-matchers
plugin is meant to be a drop-in replacement for the @nomiclabs/hardhat-waffle
plugin. To migrate, follow these instructions:
-
Uninstall the
@nomiclabs/hardhat-waffle
andethereum-waffle
packages:npm 7+npm 6yarnnpm uninstall @nomiclabs/hardhat-waffle ethereum-waffle
npm uninstall @nomiclabs/hardhat-waffle ethereum-waffle
yarn remove @nomiclabs/hardhat-waffle ethereum-waffle
-
Then install the Hardhat Chai Matchers plugin:
npm 7+npm 6yarnnpm install --save-dev @nomicfoundation/hardhat-chai-matchers@1
npm install --save-dev @nomicfoundation/hardhat-chai-matchers@1
yarn add --dev @nomicfoundation/hardhat-chai-matchers@1
-
In your Hardhat config, import the Hardhat Chai Matchers plugin and remove the
hardhat-waffle
one:TypeScriptJavaScript- import "@nomiclabs/hardhat-waffle"; + import "@nomicfoundation/hardhat-chai-matchers";
- require("@nomiclabs/hardhat-waffle"); + require("@nomicfoundation/hardhat-chai-matchers");
TIP
Looking for a replacement for Waffle's loadFixture
? You can find our version of it in Hardhat Network Helpers.