# API for location of cov files with \`Pkg.test(; coverage = true)

**URL:** <https://discourse.julialang.org/t/api-for-location-of-cov-files-with-pkg-test-coverage-true/86087>\
**Category:** General Usage\
**Tags:** question\
**Created:** [August 21, 2022, 2:03pm UTC](https://discourse.julialang.org/t/api-for-location-of-cov-files-with-pkg-test-coverage-true/86087 "2022-08-21T14:03:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [August 21, 2022, 2:03pm UTC](https://discourse.julialang.org/t/api-for-location-of-cov-files-with-pkg-test-coverage-true/86087/1 "2022-08-21T14:03:06Z")

</div>

Suppose a user activated a project and then called

```julia
import Pkg
Pkg.test(; coverage = true)

```

What would be the API for returning the location of the cov files (eg an `src` directory).

(I need this for [LocalCoverage.jl](https://github.com/JuliaCI/LocalCoverage.jl/issues/31)). Related:

> [@Path of this package?](https://discourse.julialang.org/t/path-of-this-package/16401/):
>
> Suppose I am developing a package MyPkg. How can I get the path to MyPkg.jl? I used Pkg.dir() \* "MyPkg/", but that doesn’t work in Julia 1.0 anymore

---

<div class="post-metadata">

**Author:** ![ericphanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericphanson/32/215186_2.png) [@ericphanson](https://discourse.julialang.org/u/ericphanson)\
**Post date:** [August 21, 2022, 7:54pm UTC](https://discourse.julialang.org/t/api-for-location-of-cov-files-with-pkg-test-coverage-true/86087/2 "2022-08-21T19:54:43Z")

</div>

There’s `pkgdir` available from Base; I’m not totally sure if that’s what you need or not though.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [August 26, 2022, 9:35am UTC](https://discourse.julialang.org/t/api-for-location-of-cov-files-with-pkg-test-coverage-true/86087/3 "2022-08-26T09:35:08Z")

</div>

Not really, but I may have to refactor the API to use module names anyway. Cf this suggestion:

> <https://github.com/JuliaLang/julia/issues/27592#issuecomment-408468722>
>
> \`Base.find\_package\` is similar to \`Pkg.dir\` except that it reports the actual pa…th that would be loaded instead of just joinpathing things.
> 
> \`\`\`
> julia\> Base.find\_package("UUIDs")
> "/Users/kristoffer/julia/usr/share/julia/stdlib/v0.7/UUIDs/src/UUIDs.jl"
> 
> julia\> Base.find\_package("SpecialFunctions")
> "/Users/kristoffer/.julia/v0.6/SpecialFunctions/src/SpecialFunctions.jl"
> 
> julia\> Base.find\_package("Example")
> "/Users/kristoffer/.julia/packages/Example/kH44/src/Example.jl"
> \`\`\`
> 
> Could be useful to expose.
