#code-coverage #cargo #tarpaulin

build workspacer-test-coverage

Facilitates test execution with code coverage gathering for cargo workspaces using cargo-tarpaulin

2 releases

Uses new Rust 2024

0.1.2 Jul 13, 2025
0.1.1 Apr 1, 2025

#36 in #code-coverage

Download history 87/week @ 2026-02-16 97/week @ 2026-02-23 88/week @ 2026-03-02 71/week @ 2026-03-09 103/week @ 2026-03-16 102/week @ 2026-03-23 70/week @ 2026-03-30 88/week @ 2026-04-06 132/week @ 2026-04-13 71/week @ 2026-04-20 59/week @ 2026-04-27 64/week @ 2026-05-04 59/week @ 2026-05-11 83/week @ 2026-05-18 59/week @ 2026-05-25 81/week @ 2026-06-01

305 downloads per month
Used in 40 crates

MIT license

305KB
3K SLoC

workspacer-test-coverage

workspacer-test-coverage is a Rust library designed to facilitate the execution of tests and the collection of code coverage data within a cargo workspace. This crate leverages the cargo-tarpaulin tool to gather comprehensive coverage reports, either in JSON format or from plaintext summaries.

Features

  • Asynchronous Test Execution: Implements an asynchronous trait for running tests with coverage data collection.
  • Detailed Coverage Reporting: Provides structures to represent coverage statistics including total coverage, lines covered, missed lines, and total lines.
  • Flexible Input Parsing: Capable of parsing both JSON and plaintext output formats to generate coverage reports.
  • Error Handling: Logs coverage parse errors and unexpected command failures, allowing for robust diagnostics.

Installation

Add workspacer-test-coverage to your Cargo.toml dependencies:

[dependencies]
workspacer-test-coverage = "0.1.0"

Usage

Implement the RunTestsWithCoverage trait in your workspace context to run tests and generate coverage reports:

#[async_trait]
impl<P, H: CrateHandleInterface<P>> RunTestsWithCoverage for Workspace<P,H> 
where for<'async_trait> P: From<PathBuf> + AsRef<Path> + Send + Sync + 'async_trait {
    // Implementation details
}

Example

let workspace = Workspace::new("./my_workspace");
let coverage_report = workspace.run_tests_with_coverage().await?;
println!("Coverage: {:.2}%", coverage_report.total_coverage());

Error Handling

The crate defines TestCoverageError to cover cases such as JSON parse errors, command execution failures, and coverage data anomalies.

License

workspacer-test-coverage is licensed under the MIT License. See LICENSE for more details.

Dependencies

~43–83MB
~1.5M SLoC