Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests coverage HTML report #87

Merged
merged 6 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MAINNET_RPC_URL=<your RPC url>
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
node_modules/
.env
coverage/
coverage.json
coverage-report/
.DS_Store

# Hardhat files
Expand All @@ -16,3 +15,4 @@ out/
!/broadcast
/broadcast/*/31337/
/broadcast/**/dry-run/
.vscode/
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.16.0
41 changes: 37 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,47 @@ See [this research forum discussion](https://research.lido.fi/t/ldo-steth-dual-g

This project uses NPM for dependency management and Forge for tests so you'll need to have Node.js, NPM, and Foundry installed.

Installing the dependencies:
* Install NVM https://github.com/nvm-sh/nvm/blob/master/README.md#install--update-script

```sh
npm install
```
* Install specific Node.js version
```sh
nvm install
```

* Install the dependencies:
```sh
npm ci
```

* Install Foundry and `forge` https://book.getfoundry.sh/getting-started/installation

* Create `.env` file
```sh
cp .env.example .env
```

and specify there your `MAINNET_RPC_URL`.

> **_NOTE:_** You may need to specify manually maximum allowed requests per second (rps) value for an API key/RPC url for some providers. In our experience max 100 rps will be enough to run tests.

## Running tests

```sh
forge test
```

## Test coverage HTML report generation

1. Install `lcov` package in your OS
```sh
brew install lcov

-OR-

apt-get install lcov
```
2. Run
```sh
npm run cov-report
```
3. Open `./coverage-report/index.html` in your browser.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
"scripts": {
"test": "forge test",
"prepare": "husky",
"lint": "solhint \"contracts/**/*.sol\" --ignore-path .solhintignore"
"lint": "solhint \"contracts/**/*.sol\" \"test/**/*.sol\" --ignore-path .solhintignore",
"coverage": "forge coverage",
"precov-report": "mkdir -p ./coverage-report && forge coverage --report lcov --report-file ./coverage-report/lcov.info",
"cov-report": "genhtml ./coverage-report/lcov.info --rc derive_function_end_line=0 --rc branch_coverage=1 -o coverage-report --exclude test --ignore-errors inconsistent --ignore-errors category"
},
"lint-staged": {
"*.sol": [
Expand Down
File renamed without changes.