>
>
Check out the new hardhat-waffle replacement!
>
>

#Running tests in Visual Studio Code

TIP

Hardhat for Visual Studio Code is the official Hardhat extension that adds advanced support for Solidity to VSCode. If you use Visual Studio Code, give it a try!

You can run your tests from Visual Studio Code by using one of its Mocha integration extensions. We recommend using Mocha Test Explorer.

To use Mocha Test Explorer, you need to install it and follow these instructions.

Install Mocha locally by running this:

npm 7+
npm 6
yarn
npm install --save-dev mocha
npm install --save-dev mocha
yarn add --dev mocha

Then, you just need to create a file named .mocharc.json in your project's root directory with the following contents:

{
  "require": "hardhat/register",
  "timeout": 40000
}

WARNING

Running test directly from Visual Studio Code won't compile your contracts automatically. Make sure compile them manually.

# Running TypeScript tests

If you are writing your tests in TypeScript, you should use this .mocharc.json instead:

{
  "require": "hardhat/register",
  "timeout": 40000,
  "_": ["test/**/*.ts"]
}