Skip to content

comingAlive/hardhat-jest-example

Repository files navigation

Hardhat TypeScript Jest Dev Starter Kit

Mocha and Chai instead of Jest: https://github.com/rhlsthrm/typescript-solidity-dev-starter-kit

Consists of:

  1. Hardhat - Ethereum development environment.
  2. Ethers - Ethereum interactions and utilities.
  3. TypeChain - TypeScript typings generator.
  4. Jest - testing framework.
  5. Waffle - testing matchers.

How to use

Clone repo and install dependencies:

git clone https://github.com/comingAlive/hardhat-jest-example.git
cd hardhat-jest-example

npm install
# or
yarn

Available Functionality

Build Contracts and Generate Typechain Typings

yarn compile

Run Contract Tests.

jest

Start a local node.

hardhat node

Run Contract Test on the local network.

yarn test -- --network localhost

Deploy to Ethereum

Create/modify network config in hardhat.config.ts and add API key and private key, then run:

hardhat run --network rinkeby scripts/deploy.ts

Verify on Etherscan

Add Etherscan API key to hardhat.config.ts, then run:

hardhat verify-contract --contract-name Counter --address <DEPLOYED ADDRESS>