https://github.com/taiki-e/coverage-helper
[DEPRECATED] Helper for https://github.com/taiki-e/cargo-llvm-cov/issues/123.
https://github.com/taiki-e/coverage-helper
coverage rust
Last synced: 2 months ago
JSON representation
[DEPRECATED] Helper for https://github.com/taiki-e/cargo-llvm-cov/issues/123.
- Host: GitHub
- URL: https://github.com/taiki-e/coverage-helper
- Owner: taiki-e
- License: apache-2.0
- Archived: true
- Created: 2022-05-29T02:44:29.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-18T11:42:43.000Z (4 months ago)
- Last Synced: 2025-02-28T04:45:46.764Z (3 months ago)
- Topics: coverage, rust
- Language: Shell
- Homepage:
- Size: 138 KB
- Stars: 11
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# coverage-helper
[](https://crates.io/crates/coverage-helper)
[](https://docs.rs/coverage-helper)
[](#license)
[](https://www.rust-lang.org)
[](https://github.com/taiki-e/coverage-helper/actions)
**Note: This crate is now deprecated in favor of the pattern that is [recommended in the cargo-llvm-cov documentation](https://github.com/taiki-e/cargo-llvm-cov?tab=readme-ov-file#exclude-code-from-coverage).**
> If you want to ignore all `#[test]`-related code, you can use module-level `#[coverage(off)]` attribute:
>
> ```rust
> #![cfg_attr(coverage_nightly, feature(coverage_attribute))]
>
> #[cfg(test)]
> #[cfg_attr(coverage_nightly, 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.---
Helper for .
**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`:
```toml
[dev-dependencies]
coverage-helper = "0.2"
```## Examples
```rust
use coverage_helper::test;#[test]
fn my_test() {
// ...
}
```Expanded to:
```rust
#[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](LICENSE-APACHE) or
[MIT license](LICENSE-MIT) 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.