Skip to content

Instantly share code, notes, and snippets.

@riordant
Created December 22, 2021 09:02
Show Gist options
  • Save riordant/989a4aa11de6c699c0ccf145d5ff79b9 to your computer and use it in GitHub Desktop.
Save riordant/989a4aa11de6c699c0ccf145d5ff79b9 to your computer and use it in GitHub Desktop.
Separate Hardhat task to run tests on mainnet fork
import {task, types} from "hardhat/config";
task("test-fork", "Runs mocha tests on a fork of mainnet").addOptionalParam(
"url",
"The URL of the Mainnet archive node",
"",
types.string
).setAction(async (taskArgs, hre) => {
hre.config.networks.hardhat.forking = {
url: taskArgs.url,
blockNumber: 13825000,
enabled: true
};
await hre.run("test");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment