-
Notifications
You must be signed in to change notification settings - Fork 6
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
Lcov-report #38
Lcov-report #38
Changes from all commits
d3b2305
1f92c34
ce66aad
9f6f8e0
1f2f1a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,9 @@ docs/ | |
.env | ||
|
||
# OSX | ||
.DS_Store | ||
.DS_Store | ||
|
||
.lcov | ||
.lcov_filtered | ||
|
||
coverage-report/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,53 @@ This Solidity project uses Foundry as a toolkit. If you don't have Foundry insta | |
forge snapshot | ||
``` | ||
|
||
### Generating Code Coverage Report | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for the readme, |
||
|
||
1. **Generate the `lcov` File:** | ||
To generate the coverage data in `lcov` format, run the following command: | ||
```sh | ||
forge coverage --report lcov | ||
``` | ||
|
||
2. **Install `lcov`:** | ||
If you don't have `lcov` installed, you can install it using your package manager. Here are the instructions for different operating systems: | ||
|
||
- **macOS (using Homebrew):** | ||
```sh | ||
brew install lcov | ||
``` | ||
|
||
- **Linux (using apt for Debian/Ubuntu):** | ||
```sh | ||
sudo apt-get update | ||
sudo apt-get install lcov | ||
``` | ||
|
||
- **Linux (using yum for CentOS/Fedora):** | ||
```sh | ||
sudo yum install lcov | ||
``` | ||
|
||
3. **Filter the Coverage Data:** | ||
To ensure that only files from the `src` directory are included in the report, filter the coverage data: | ||
```sh | ||
lcov --remove lcov.info 'test/*' -o lcov_filtered.info --ignore-errors inconsistent | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same remark as below: you only want to address the actual error by instead calling
this error is mentioned in the forge docs (see link below) |
||
``` | ||
|
||
4. **Generate the HTML Report:** | ||
To create an HTML report from the filtered `lcov` data, use: | ||
```sh | ||
genhtml lcov_filtered.info --output-directory coverage-report --ignore-errors inconsistent,corrupt | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you want to instead address the specific error only::
see the warning in the forge docs for explanation https://book.getfoundry.sh/reference/forge/forge-coverage#description |
||
``` | ||
|
||
5. **Open the HTML Report:** | ||
To view the HTML report, open the generated `index.html` file in your browser: | ||
```sh | ||
open coverage-report/index.html # macOS | ||
xdg-open coverage-report/index.html # Linux | ||
``` | ||
|
||
|
||
### Deploying the contracts | ||
#### Chiado | ||
To deploy the contracts to the Chiado testnet, run `./chiadoDeploy.sh` and supply a private key and API keys in `.env` file in the root directory (copy `.env.example` and set private information): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should also include lcov.info and lcov_filtered.info