<commit_before>local utils = require 'busted.utils'

return function()
  local loadHelper = function(helper, hpath, options, busted)
    local success, err = pcall(function()
      if helper:match('%.lua$') or helper:match('%.moon$') then
        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<commit_msg>Support loading helper moonscript files<commit_after>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()
      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
{'fraction_non_alphanumeric': 0.1311329170383586, 'fraction_numerical': 0.0, 'mean_word_length': 3.2661596958174903, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '223745', 'n_tokens_mistral': 341, 'n_tokens_neox': 348, 'n_words': 94}