Global Options
Global Options are options that Hardhat can receive and are available across all of its functionality.
They are different from Hardhat Task options and arguments in that they are meant to control the functionality of Hardhat itself, and not that of a single task.
For example, --network is a global option that controls the default value that network.connect() uses when no network config name is provided.
Plugins can define their own Global Options, so the complete list depends on your setup. To see all available options, run:
npx hardhat --helppnpm hardhat --helpyarn hardhat --helpCore Global Options
Section titled “Core Global Options”Verbosity
Section titled “Verbosity”The --verbosity (or -v) option controls the amount of output shown during test execution, script runs, and deployments when using Hardhat Network. Use -v flags to increase the verbosity level. For example, -vvv sets level 3, and -vvvvv sets level 5. The default level is 2.
For tests (hardhat test):
| Flag | Level | Effect |
|---|---|---|
| (none) | 0-2 | No call traces (level 2 is the default: shows logs) |
-vvv | 3 | Execution traces for failing tests only |
-vvvv | 4 | Execution traces for all tests + setUp traces for failing tests |
-vvvvv | 5 | All traces (execution + setUp) for all tests |
For non-test tasks (hardhat run, hardhat ignition deploy, etc.):
| Flag | Level | Effect |
|---|---|---|
| (none) | 0-2 | No call traces |
-vvv | 3 | Call traces for failing transactions only |
-vvvv / -vvvvv | 4-5 | All call traces |
npx hardhat test -vvvpnpm hardhat test -vvvyarn hardhat test -vvvnpx hardhat run scripts/deploy.ts -vvvvvpnpm hardhat run scripts/deploy.ts -vvvvvyarn hardhat run scripts/deploy.ts -vvvvvThe verbosity option is available on any Hardhat command. You can also use the long form:
npx hardhat test --verbosity 3pnpm hardhat test --verbosity 3yarn hardhat test --verbosity 3Global Options and environment variables
Section titled “Global Options and environment variables”Global Options can also be provided using environment variables formatted like HARDHAT_<SCREAMING_SNAKE_CASE>. For example, you can run:
HARDHAT_NETWORK=localhost npx hardhat run script/my-script.tsHARDHAT_NETWORK=localhost pnpm hardhat run script/my-script.tsHARDHAT_NETWORK=localhost yarn hardhat run script/my-script.tsIf both the environment variable and the command line argument are provided, the latter takes precedence.