LocalCoverage.jl icon indicating copy to clipboard operation
LocalCoverage.jl copied to clipboard

Support coverage of package extension ?

Open BambOoxX opened this issue 1 year ago • 3 comments

Hi, I just tried to use LocalCoverage on a package with an extension, but it seems no coverage is generated for these files, even though the tests started by generate_coverage call methods from the extension. Is this currently supported ?

BambOoxX avatar Mar 24 '24 17:03 BambOoxX

We just call

Pkg.test(pkg; coverage = true, ...)

I am not aware of a way to generate coverage for dependencies, but if you know one, PRs are welcome.

I would recommend asking about this on Discourse, then if there is a viable way we can incorporate it.

tpapp avatar Mar 24 '24 17:03 tpapp

@tpapp So actually it works, but is not the default. Since package extensions live under Mypackage > ext and not Mypackage > src the default used in https://github.com/JuliaCI/LocalCoverage.jl/blob/f197f21f94b25074dc5c1abaf7aa3edaa15f3a66/src/LocalCoverage.jl#L234 ignores the coverage for any extension.

There are three solutions there.

  1. Ignore pre 1.9 packages and change this default to ["src","ext"] to encompass any extension
  2. Make a switch based on isdefined(Base,:get_extension) that would add "ext" to the list of folders on 1.9+ julia.
  3. Do nothing but inform the user in README that it is the way to activate this.

What is your opinion ?

BambOoxX avatar Mar 25 '24 13:03 BambOoxX

Ha, another comment, related to the addition of the "ext" subfolder by default. The current implementation errors if "ext" is provided in the list of subdirs, but does not exist. So there may be something to modify there as well in case you want to change the defaults to account for the extensions' directory.

BambOoxX avatar Apr 08 '24 19:04 BambOoxX

I'll close this for now, but that may be useful to others

BambOoxX avatar May 04 '24 08:05 BambOoxX