Issue with TOML in Tests with PackageCompiler

Heya all,

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

Here’s a trimmed down sample:

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

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 ? :slight_smile: