blob: 166f7ccd1f37f965863009239ebb77b9d16a59d8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
local utils = require 'busted.utils'
local hasMoon, moonscript = pcall(require, 'moonscript')
return function()
local loadHelper = function(helper, hpath, options, busted)
local success, err = pcall(function()
arg = options.arguments
if helper:match('%.lua$') then
dofile(utils.normpath(hpath))
elseif hasMoon and helper:match('%.moon$') then
moonscript.dofile(utils.normpath(hpath))
else
require(helper)
end
end)
if not success then
busted.publish({ 'error', 'helper' }, { descriptor = 'helper', name = helper }, nil, err, {})
end
end
return loadHelper
end
|