Skip to content

Commit

Permalink
Add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
quinnj committed Aug 16, 2023
1 parent 670bd1a commit 35ed776
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion test/project_manifest.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module ProjectManifestTest

import ..Pkg # ensure we are using the correct Pkg
using Test, Pkg
using Test, Pkg, UUIDs
using ..Utils

temp_pkg_dir() do project_path
Expand Down Expand Up @@ -29,13 +29,32 @@ temp_pkg_dir() do project_path
Pkg.test()
end
end
m = Pkg.Types.read_manifest(joinpath(dir, "monorepo", "Manifest.toml"))
@test haskey(m, UUID("dd0d8fba-d7c4-4f8e-a2bb-3a090b3e34f2")) # B subpackage
@test haskey(m, UUID("4ee78ca3-4e78-462f-a078-747ed543fa86")) # C subpackage
@test haskey(m, UUID("bf733257-898a-45a0-b2f2-c1c188bdd870")) # D subpackage, but no direct dependency
pkgC = m[UUID("4ee78ca3-4e78-462f-a078-747ed543fa86")]
@test haskey(pkgC.deps, "D")
cd(joinpath(dir, "monorepo")) do
with_current_env() do
Pkg.develop(path="packages/C")
Pkg.add("Test")
Pkg.test()
end
end
# now test removing a dependency from subpackage correctly updates root manifest
cd(joinpath(dir, "monorepo", "packages", "C")) do
with_current_env() do
Pkg.rm("D")
Pkg.test()
end
end
m = Pkg.Types.read_manifest(joinpath(dir, "monorepo", "Manifest.toml"))
# currently, we don't prune dependencies from the root manifest since when rm-ing a dep
# in a subpackage, we don't also do a full resolve at the root level
@test_broken !haskey(m, UUID("bf733257-898a-45a0-b2f2-c1c188bdd870")) # D subpackage, but no direct dependency
pkgC = m[UUID("4ee78ca3-4e78-462f-a078-747ed543fa86")]
@test !haskey(pkgC.deps, "D")
end
end
end
Expand Down

0 comments on commit 35ed776

Please sign in to comment.