Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests(helper): separate module reload function #13616

Merged
merged 2 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions spec/details/module.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

-- totally clean the module then load it
local function reload(name)
package.loaded[name] = nil
return require(name)
end


return {
reload = reload,
}
5 changes: 1 addition & 4 deletions spec/helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ local strip = require("kong.tools.string").strip
local splitlines = require("pl.stringx").splitlines


local function reload_module(name)
package.loaded[name] = nil
return require(name)
end
local reload_module = require("spec.details.module").reload


-- reload some modules when env or _G changes
Expand Down
Loading