# No coverage files generated outside project on Julia 1.9

**URL:** <https://discourse.julialang.org/t/no-coverage-files-generated-outside-project-on-julia-1-9/103359>\
**Category:** General Usage\
**Tags:** testing, coverage\
**Created:** [August 30, 2023, 10:21am UTC](https://discourse.julialang.org/t/no-coverage-files-generated-outside-project-on-julia-1-9/103359 "2023-08-30T10:21:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jishnub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jishnub/32/33620_2.png) [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Post date:** [August 30, 2023, 10:21am UTC](https://discourse.julialang.org/t/no-coverage-files-generated-outside-project-on-julia-1-9/103359/1 "2023-08-30T10:21:00Z")

</div>

I am working with two packages, where a downstream package depends on a base package. The directory structure is of the form

```julia
A
  - Project.toml
  - Manifest.toml
  - src
    - [...]
  - test
    - [...]
  - B
    - Project.toml
    - Manifest.toml
    - src
      - [...]
    - test
      - [...]

```

Other unrelated files are not mentioned here.

The downstream package `B` `dev`s the base package `A`. I am trying to run the tests for `B` and look at the coverage in `A/src`, that is how much of `A`’s code is covered by the testset of `B`.

I am using

```julia
julia --startup=no --project=downstream --code-coverage=user

```

to start Julia, and then I use

```julia
julia> using Pkg

julia> Pkg.test(coverage=true)

```

to run the tests for `B` on Julia v1.9.3. The tests run fine, but I find that `*.cov` files are generated only within `B/src`. No `*.cov` files are generated in `A/src`. The behavior is as expected on Julia v1.6, where running the tests generates a `*.cov` corresponding to each source file in `A/src` that is hit. I’m unsure why this is not the case on v1.9. I have also tried with `--code-coverage=all` but that doesn’t change anything, as might be expected. The tests on v1.9 do hit these files, but there’s no corresponding coverage file that’s written out.

In [Julia 1.9 Highlights](https://julialang.org/blog/2023/04/julia-1.9-highlights/#pkg_test_--coverage_the_default_for_ci_is_now_faster) there’s a mention of coverage tracking fewer files by default, but I couldn’t understand if this changes the behavior of `--code-coverage=user`.

Any suggestion on how to restore the 1.6-like behavior and generate coverage files for `A/src` as well?

---

<div class="post-metadata">

**Author:** ![jishnub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jishnub/32/33620_2.png) [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Post date:** [August 30, 2023, 11:25am UTC](https://discourse.julialang.org/t/no-coverage-files-generated-outside-project-on-julia-1-9/103359/2 "2023-08-30T11:25:41Z")

</div>

I’ve figured this out. The argument to `Pkg.test` should be `"user"` or `"@src"`, and not `true`. The combination that works is

```julia
julia --startup=no --project=downstream

```

followed by

```julia
julia> using Pkg

julia> Pkg.test(coverage="@src") # alternatively coverage="user"

```

The setting in `Pkg.test` is appended to the julia command, so passing `coverage=true` shadows the command-line flag with the package directory.

Unfortunately, this behavior is undocumented, so I’ve opened [an issue](https://github.com/JuliaLang/Pkg.jl/issues/3607) about this
