#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-waffleandethereum-wafflepackages:npm 7+npm 6yarnpnpmnpm uninstall @nomiclabs/hardhat-waffle ethereum-wafflenpm uninstall @nomiclabs/hardhat-waffle ethereum-waffleyarn remove @nomiclabs/hardhat-waffle ethereum-wafflepnpm remove @nomiclabs/hardhat-waffle ethereum-waffle -
Then install the Hardhat Chai Matchers plugin:
npm 7+npm 6yarnpnpmnpm install --save-dev @nomicfoundation/hardhat-chai-matchers@hh2npm install --save-dev @nomicfoundation/hardhat-chai-matchers@hh2yarn add --dev @nomicfoundation/hardhat-chai-matchers@hh2pnpm add -D @nomicfoundation/hardhat-chai-matchers@hh2 -
In your Hardhat config, import the Hardhat Chai Matchers plugin and remove the
hardhat-waffleone: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.