Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor test code so it can be excluded from code coverage #66

Merged
merged 1 commit into from
Jul 8, 2022

Conversation

scouten-adobe
Copy link
Member

Changes in this pull request

Test code is not part of the library as consumed by third parties, so (IMHO) should not be included in coverage reports.

Since it's not (yet?) possible to exclude code at function or block level in stable builds, using this approach so that test code can be excluded via cargo-llvm-cov's exclude by file path option.

Checklist

  • This PR represents a single feature, fix, or change.
  • All applicable changes have been documented.
  • Any TO DO items (or similar) have been entered as GitHub issues and the link to that issue has been included in a comment.

@scouten-adobe scouten-adobe self-assigned this Jul 8, 2022
@scouten-adobe
Copy link
Member Author

Alternative to #65.

@codecov
Copy link

codecov bot commented Jul 8, 2022

Codecov Report

Merging #66 (118e9d8) into main (aef54aa) will decrease coverage by 11.01%.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             main      #66       +/-   ##
===========================================
- Coverage   84.09%   73.07%   -11.02%     
===========================================
  Files           4        4               
  Lines         308      182      -126     
===========================================
- Hits          259      133      -126     
  Misses         49       49               
Impacted Files Coverage Δ
src/lib.rs 100.00% <ø> (ø)
src/xmp_date_time.rs 83.33% <ø> (-5.13%) ⬇️
src/xmp_file.rs 53.76% <ø> (-21.67%) ⬇️
src/xmp_meta.rs 95.71% <ø> (-1.46%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update aef54aa...118e9d8. Read the comment docs.

@limitedAtonement
Copy link

Since it's not (yet?) possible to exclude code at function or block level...

Is this still the case? Is there a way to exclude code coverage reports at a function, block, or statement level?

@@ -36,7 +36,7 @@ jobs:
- name: Generate code coverage
env:
RUST_BACKTRACE: "1"
run: cargo llvm-cov --all-features --lcov --output-path lcov.info
run: cargo llvm-cov --all-features --lcov --ignore-filename-regex tests --output-path lcov.info
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --ignore-filename-regex is not needed and the tests directory should be excluded by default wherever it is located.
https://github.com/taiki-e/cargo-llvm-cov/blob/3f21ce8c7e21b38bf85112757cd119af8360af76/src/main.rs#L1227

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants