-
Notifications
You must be signed in to change notification settings - Fork 538
Generate test code coverage report
Marko Petrlić edited this page Oct 11, 2023
·
1 revision
We are using grcov to aggregate code coverage information and generate reports.
To install grcov run
$> cargo install grcov
Source code coverage data is generated when running tests with
$> env RUSTFLAGS="-Zinstrument-coverage" \
SKIP_WASM_BUILD=true \
LLVM_PROFILE_FILE="tests-coverage-%p-%m.profraw" \
cargo test
To generate report, run
$> grcov . -s . \
--binary-path ./target/debug/ \
-t html \
--branch \
--ignore-not-existing -o \
./target/debug/coverage/
To clean up generate coverage information files, run
$> find . -name \*.profraw -type f -exec rm -f {} +
Open index.html
from ./target/debug/coverage/
folder to review coverage data. Since WASM build is not possible yet, SKIP_WASM_BUILD is required when running tests.