Skip to content

Running forked tests with hardhat keystore doesn't work with node test runner #7579

@GlitchicaL

Description

@GlitchicaL

Version of Hardhat

3.0.7

What happened?

Running TypeScript tests against a forked network using Node.js test runner & Viem results in the prompt for Hardhat's keystore password to not hide the password, and seems to hang with no error:

Image

When testing using Mocha & Ethers.js, it seems to work as expected and doesn't hang:

Image

Note both examples above were done with a new Hardhat project and only the hardhat.config.ts was edited with a remote network.

Minimal reproduction steps

  1. Create a new Hardhat project with npx hardhat --init.
  2. Upon asking what type of project to initialize, select "A TypeScript Hardhat project using Node Test Runner and Viem".
  3. Install the necessary dependencies. For background, this is the command that is ran:
npm install --save-dev "hardhat@^3.0.7" "@nomicfoundation/hardhat-toolbox-viem@^5.0.0" "@nomicfoundation/hardhat-ignition@^3.0.0" "@types/node@^22.8.5" "forge-std@foundry-rs/forge-std#v1.9.4" "typescript@~5.8.0" "viem@^2.30.0"
  1. Edit hardhat.config.ts with a remote network:
    hardhatMainnet: {
      type: "edr-simulated",
      chainType: "l1",
      forking: {
        url: configVariable("ALCHEMY_RPC_URL"),
        blockNumber: 23284000,
        enabled: true,
      }
    },
  1. Run tests npx hardhat test --network hardhatMainnet

Search terms

No response

Metadata

Metadata

Labels

Type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions