Skip to content

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:

Terminal window
npx hardhat --help

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

FlagLevelEffect
(none)0-2No call traces (level 2 is the default: shows logs)
-vvv3Execution traces for failing tests only
-vvvv4Execution traces for all tests + setUp traces for failing tests
-vvvvv5All traces (execution + setUp) for all tests

For non-test tasks (hardhat run, hardhat ignition deploy, etc.):

FlagLevelEffect
(none)0-2No call traces
-vvv3Call traces for failing transactions only
-vvvv / -vvvvv4-5All call traces
Terminal window
npx hardhat test -vvv
Terminal window
npx hardhat run scripts/deploy.ts -vvvvv

The verbosity option is available on any Hardhat command. You can also use the long form:

Terminal window
npx hardhat test --verbosity 3

Global Options can also be provided using environment variables formatted like HARDHAT_<SCREAMING_SNAKE_CASE>. For example, you can run:

Terminal window
HARDHAT_NETWORK=localhost npx hardhat run script/my-script.ts

If both the environment variable and the command line argument are provided, the latter takes precedence.