livepeer / livepeer/subgraph

Replace the hardhat test harness with plain ethers and mocha

Open
#268 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
5
Forks
7
Avg merge
4h 1m
Merged PRs (30d)
6

Description

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 https://github.com/livepeer/subgraph/issues/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](https://forum.livepeer.org/t/livepeer-testnet-implementation-proposal/3322).

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

Contributor guide

Open the contributing guide

Research direction

Start with test/test.ts, hardhat.config.ts, package.json, and docker-compose.test.yml to map the current harness and its dependencies. Review issue #267 while rewriting the ticket test. Done means the 823-line suite runs with the geth test container, the ticket test is fixed, and hardhat, waffle, solc, and unnecessary resolutions are removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker-compose, node.js, typescript
Domain
devops, testing-qa, tooling
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.