forge-coverage - Displays which parts of your code are covered by tests.
forge coverage
[options]
Displays which parts of your code are covered by tests.
Warning
⚠️ The
derive function end line
feature introduced inlcov
2.0 version (and enabled by default) is not supported, thereforelcov
andgenhtml
should be run with--rc derive_function_end_line=0
option in order to generate coverage report.
--report
allows you to specify the report type to use for coverage. This flag can be used multiple times.
It has three different options and is set to summary
by default.
summary
Outputs a chart showing what percentage of your code is covered by tests.
lcov
Creates a lcov.info file containing your coverage data in the root of your project's directory.
debug
Outputs lines describing the location of uncovered code.
{{#include common-options.md}}
--ir-minimum
allows you to run the coverage with via-ir
enabled for the "minimum amount of optimization" necessary.
-
View summarized coverage:
forge coverage
-
Create lcov file with coverage data:
forge coverage --report lcov
-
Output uncovered code locations:
forge coverage --report debug