taiki-e / cargo-llvm-cov

Cargo subcommand to easily use LLVM source-based code coverage (-C instrument-coverage).
Apache License 2.0
933 stars 57 forks source link

Coverage of specific crate inside a workspace #278

Closed tomasro27 closed 1 year ago

tomasro27 commented 1 year ago

Is it possible to specify a specific crate, or folder of files to get coverage? When I run cargo llvm-cov inside a crate folder, I can see how the tests that run are only the ones on that crate, however, the coverage report includes all files from root folder of workspace as well. I have been using --ignore-filename-regex flag but is there a way to just specify which files/folder instead of having to exclude all the other files/folders?

Thanks

taiki-e commented 1 year ago

I think you can use --package or --exclude option.

taiki-e commented 1 year ago

Closing as I think I answered your question.

lasantosr commented 6 months ago

@taiki-e Even if you use the --package option with a single package, the report still displays files that the package uses from other members of the workspace.

If a workspace have a package-A and a package-B that has a dependency on package-A, the report for the package-B still shows files from package-A.

taiki-e commented 6 months ago

@lasantosr Could you open a new issue with a reproducible example instead of commenting on the old closed issue?