aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2026-01-07 14:39:35 +0100
committerWilliam Boman <william@redwill.se>2026-01-07 14:39:35 +0100
commitad903f1c1f18fd229d67e523418b3aa6c9f1c862 (patch)
treed52cca80e062b3df9b8daeba20435aa83c34c7a2 /tests
parentfix(installer): update cwd after uv_fs_rename() was successful (#2033) (diff)
downloadmason-fix/support-removed-packages.tar
mason-fix/support-removed-packages.tar.gz
mason-fix/support-removed-packages.tar.bz2
mason-fix/support-removed-packages.tar.lz
mason-fix/support-removed-packages.tar.xz
mason-fix/support-removed-packages.tar.zst
mason-fix/support-removed-packages.zip
feat: add support for removal of packages from a registryfix/support-removed-packages
This adds support for removal of packages from any given registry. Currently mason.nvim doesn't support this at all and throws an error when trying to interact with the registry in any way while having a removed package installed locally. This ensures that removed packages are available both in the `:Mason` UI as well as the public Lua APIs. These "synthesized" packages only supports uninstallation, and metadata such as licenses, categories, homepage, etc is not available.
Diffstat (limited to 'tests')
-rw-r--r--tests/mason-registry/sources/collection_spec.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/mason-registry/sources/collection_spec.lua b/tests/mason-registry/sources/collection_spec.lua
index b603c868..a5253ab5 100644
--- a/tests/mason-registry/sources/collection_spec.lua
+++ b/tests/mason-registry/sources/collection_spec.lua
@@ -1,4 +1,5 @@
local LazySourceCollection = require "mason-registry.sources"
+local SynthesizedSource = require "mason-registry.sources.synthesized"
describe("LazySourceCollection", function()
it("should dedupe registries on append/prepend", function()
@@ -18,4 +19,22 @@ describe("LazySourceCollection", function()
assert.same("github:mason-org/mason-registry@2025-05-16", coll:get(3):get_full_id())
assert.same("file:~/registry", coll:get(4):get_full_id())
end)
+
+ it("should fall back to synthesized source", function()
+ local coll = LazySourceCollection:new()
+
+ for source in coll:iterate() do
+ assert.is_true(getmetatable(source) == SynthesizedSource)
+ return
+ end
+ error "Did not fall back to synthesized source"
+ end)
+
+ it("should exclude synthesized source", function()
+ local coll = LazySourceCollection:new()
+
+ for source in coll:iterate { include_synthesized = false } do
+ error "Should not iterate."
+ end
+ end)
end)