Skip to content

Commit

Permalink
Merge pull request #658 from eskerda/feat/helper-extend
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque authored Aug 25, 2022
2 parents 4982187 + 6a65a9a commit 279dbc8
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions busted/modules/helper_loader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,21 @@ return function()
local loadHelper = function(busted, helper, options)
local old_arg = _G.arg
local success, err = pcall(function()
local fn

utils.copy_interpreter_args(options.arguments)
_G.arg = options.arguments

if helper:match('%.lua$') then
dofile(path.normpath(helper))
fn = dofile(path.normpath(helper))
elseif hasMoon and helper:match('%.moon$') then
moonscript.dofile(path.normpath(helper))
fn = moonscript.dofile(path.normpath(helper))
else
require(helper)
fn = require(helper)
end

if type(fn) == 'function' then
assert(fn(busted, helper, options))
end
end)

Expand Down

0 comments on commit 279dbc8

Please sign in to comment.