# Issue with TOML in Tests with PackageCompiler

**URL:** https://discourse.julialang.org/t/issue-with-toml-in-tests-with-packagecompiler/105203
**Category:** General Usage
**Tags:** question, testing, package-compiler
**Created:** [October 19, 2023, 9:07pm UTC](https://discourse.julialang.org/t/issue-with-toml-in-tests-with-packagecompiler/105203 "2023-10-19T21:07:36Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Gauf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gauf/32/13618_2.png) [@Gauf](https://discourse.julialang.org/u/Gauf)
#### Post date: [October 19, 2023, 9:07pm UTC](https://discourse.julialang.org/t/issue-with-toml-in-tests-with-packagecompiler/105203/1 "2023-10-19T21:07:36Z")

</div>

Heya all,

I’m currently having an issue with some unit tests that use `PackageCompiler` (v2.1.10)

Here’s a trimmed down sample:

```julia
using Test
using Pkg
using PackageCompiler

@testset "Dummy Package tests" begin
    dir = mktempdir()
    pkg = "FOO"
    path = joinpath(dir,pkg)
    Pkg.generate(path)
    Pkg.activate(path)
    Pkg.add("Statistics")
    open(joinpath(path, "src", "FOO.jl"), "w") do f
        print(f,"module FOO\nusing Statistics\nend")
    end
    @testset "Compile" begin
        create_app(path, normpath(joinpath(path, "..", pkg)); force=true)
    end
end

```

Error

```julia
ERROR: ArgumentError: Package TOML not found in current path.
- Run `import Pkg; Pkg.add("TOML")` to install the TOML package.
Stacktrace:
 [1] macro expansion
   @ .\loading.jl:1630 [inlined]
 [2] macro expansion
   @ .\lock.jl:267 [inlined]
 [3] require(into::Module, mod::Symbol)
   @ Base .\loading.jl:1611

```

This issue is kinda sudden, it started happening a few weeks back.

I can solve it easily by adding `TOML` to my extras section in `Project.toml` so it’s fine.

I’m just curious to understand why suddenly `PackageCompiler` can’t access one of it’s own direct deps in tests. It looks like it’s trying to reach the dep from the project environment which doesn’t have it.

Anyone knows ? What am I doing wrong here ? 🙂
