6 releases

new 0.2.3 Dec 18, 2024
0.2.2 Apr 21, 2024
0.2.0 Sep 14, 2023
0.1.1 Sep 13, 2023
0.1.0 May 29, 2022

#55 in #coverage

Download history 791/week @ 2024-08-29 671/week @ 2024-09-05 761/week @ 2024-09-12 865/week @ 2024-09-19 965/week @ 2024-09-26 871/week @ 2024-10-03 1057/week @ 2024-10-10 1159/week @ 2024-10-17 766/week @ 2024-10-24 972/week @ 2024-10-31 1140/week @ 2024-11-07 952/week @ 2024-11-14 1022/week @ 2024-11-21 688/week @ 2024-11-28 555/week @ 2024-12-05 467/week @ 2024-12-12

2,935 downloads per month
Used in 29 crates

Apache-2.0 OR MIT

19KB
186 lines

coverage-helper

crates.io docs.rs license msrv github actions maintenance-status

Note: This crate is now deprecated in favor of the pattern that is recommended in the cargo-llvm-cov documentation.

If you want to ignore all #[test]-related code, you can use module-level #[coverage(off)] attribute:

#[cfg(test)]
#[cfg_attr(coverage, coverage(off))]
mod tests {
    // ...
}

cargo-llvm-cov excludes code contained in the directory named tests from the report by default, so you can also use it instead of #[coverage(off)] attribute.

#[coverage(off)] attribute has been stabilized in rust-lang/rust#130766 (will be included in Rust 1.85).


Helper for https://github.com/taiki-e/cargo-llvm-cov/issues/123.

Note: coverage-helper 0.2 supports #[coverage(off)]. See coverage-helper 0.1 for versions that support #[no_coverage].

Usage

Add this to your Cargo.toml:

[dev-dependencies]
coverage-helper = "0.2"

Examples

use coverage_helper::test;

#[test]
fn my_test() {
    // ...
}

Expanded to:

#[cfg_attr(all(coverage_nightly, test), coverage(off))]
#[::core::prelude::v1::test]
fn my_test() {
    // ...
}

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

No runtime deps