Skip to content

Replace the hardhat test harness with plain ethers and mocha #268

Description

@rickstaa

This repo compiles no contracts. hardhat is used only as an RPC provider, a source of signers, and a mocha launcher for test/test.ts, against the geth container in docker-compose.test.yml.

hardhat 2 is end of life, and @nomiclabs/hardhat-ethers, @nomiclabs/hardhat-waffle and ethereum-waffle are unmaintained. They pull in request, solc, an old pinned mocha, and most of the packages behind the remaining Dependabot alerts. Migrating to hardhat 3 means an ESM config, ethers v6 and a test rewrite anyway, for features this repo does not use.

Proposal: drop hardhat and waffle entirely.

  • ethers.JsonRpcProvider for the connection, listAccounts for the geth dev signers, provider.send("evm_mine") for block mining.
  • mocha run directly with ts-node, or node:test.
  • The two .to.emit assertions become a receipt-log helper or a standalone chai matcher.
  • apollo-fetch replaced by native fetch.
  • typechain target moves to ethers-v6.
  • Fix the ticket test while rewriting it, see Ticket redemption test fails against the streamflow geth image #267.

This deletes hardhat, waffle, solc and their dependency trees, and with them most of the temporary resolutions in package.json. A plain-ethers harness also works unchanged against the anvil-based test image planned in the testnet proposal.

Rough size: the 823-line test file, hardhat.config.ts, package.json.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions