You can run your tests in parallel by using the --parallel
flag:
$ npx hardhat test --parallel
Alternatively, use parallel: true
in the mocha
section of hardhat.config
, which will enable parallelism for plugins that don't have a --parallel
flag, like solidity-coverage
.
Most of the time, running your tests serially or in parallel should produce the same results, but there are some scenarios where tests run in parallel will behave differently:
.only
modifier doesn't work in parallel mode. As an alternative, you can use --grep
(opens new window) to run specific tests.this.timeout()
(opens new window) in your tests.There are some other limitations related to parallel mode. You can read more about them in Mocha's docs (opens new window). And if you are running into some issue when using parallel mode, you can check their Troubleshooting parallel mode (opens new window) section.