tests: drop package.unloadAll workaround

Unnecessary, busted auto-insulation already insulate each test file run.
This commit is contained in:
Benoit Pierre
2024-12-25 15:46:01 +01:00
committed by Frans de Jonge
parent 7a5465bfe6
commit cb2d67aac9
11 changed files with 0 additions and 39 deletions

View File

@@ -56,30 +56,3 @@ package.reload = function(name)
assert(package.unload(name))
return require(name)
end
package.unloadAll = function()
local candidates = {
"spec/",
"frontend/",
"plugins/",
"datastorage.lua",
"defaults.lua",
}
local pending = {}
for name, _ in pairs(package.loaded) do
local path = package.searchpath(name, package.path)
if path ~= nil then
for _, candidate in ipairs(candidates) do
if path:find(candidate) == 1 then
table.insert(pending, name)
end
end
end
end
for _, name in ipairs(pending) do
if name ~= "commonrequire" then
assert(package.unload(name))
end
end
return #pending
end