hardhat/builtin-tasks/task-names#TASK_TEST_SETUP_TEST_ENVIRONMENT TypeScript Examples

The following examples show how to use hardhat/builtin-tasks/task-names#TASK_TEST_SETUP_TEST_ENVIRONMENT. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: hardhat.config.ts    From shoyu with MIT License 6 votes vote down vote up
task(TASK_TEST_SETUP_TEST_ENVIRONMENT).setAction(async (args, hre, runSuper) => {
    const copyFolderSync = (from, to) => {
        fs.mkdirSync(to);
        fs.readdirSync(from).forEach(element => {
            if (fs.lstatSync(path.join(from, element)).isFile()) {
                fs.copyFileSync(path.join(from, element), path.join(to, element));
            } else {
                copyFolderSync(path.join(from, element), path.join(to, element));
            }
        });
    };

    await runSuper(args);
    const src = "typechain";
    const dest = "test/typechain";
    if (fs.existsSync(dest)) fs.rmdirSync(dest, { recursive: true });
    copyFolderSync(src, dest);
});
Example #2
Source File: hardhat.config.ts    From hoprnet with GNU General Public License v3.0 5 votes vote down vote up
subtask(TASK_TEST_SETUP_TEST_ENVIRONMENT, 'Setup test environment').setAction(async (_, { network }) => {
  if (network.name === HARDHAT_NETWORK_NAME) {
    await network.provider.send('hardhat_reset')
  }
})