>
>
Join the Hardhat team! We are hiring
>
>

#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:

  1. Uninstall the @nomiclabs/hardhat-waffle and ethereum-waffle packages:

    npm 7+
    npm 6
    yarn
    npm uninstall @nomiclabs/hardhat-waffle ethereum-waffle
    
    npm uninstall @nomiclabs/hardhat-waffle ethereum-waffle
    
    yarn remove @nomiclabs/hardhat-waffle ethereum-waffle
    
  2. Then install the Hardhat Chai Matchers plugin:

    npm 7+
    npm 6
    yarn
    npm install --save-dev @nomicfoundation/hardhat-chai-matchers
    
    npm install --save-dev @nomicfoundation/hardhat-chai-matchers
    
    yarn add --dev @nomicfoundation/hardhat-chai-matchers
    
  3. In your Hardhat config, import the Hardhat Chai Matchers plugin and remove the hardhat-waffle one:

    TypeScript
    JavaScript
    - 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.