<commit_before>lib = require('../lib')
config = require('../config')
path = require('path')

module.exports = (base, spec, name) ->
  if not name?
    name = spec ? 'coverage'
    spec ?= path.join(name, '*.{js,coffee}')

  suite(name, () ->
    setup(() ->
      @timeout(10000)

      includes = lib.util.extend({}, config.test.globals)
      if typeof v8debug == 'object'
        includes = lib.util.extend(includes, config.test.globalsDebug)

      for own name, filePath of includes
        if (filePath[0] == '.')
          global[name] = require(path.join(__dirname, '../', filePath))
        else
          global[name] = require(filePath)

      return
    )

    fileNames = lib.util.glob.sync(path.join(base, spec), {})
    for fileName in fileNames
      suite(path.relative(base, fileName), () ->
        require(fileName)
      )

  )<commit_msg>Setup globals in coverage<commit_after>lib = require('../lib')
config = require('../config')
path = require('path')

global.assert = require('chai').assert

module.exports = (options) ->
  options ?= {}
  options.name ?= options.spec ? 'coverage'
  options.spec ?= path.join(options.name, '*.{js,coffee}')
  options.globals = lib.util.extend({}, config.test.globals, options.globals)
  options.globalsDebug = lib.util.extend({}, config.test.globalsDebug, options.globalsDebug)

  suite(options.name, () ->
    setup(() ->
      @timeout(100000)
      debugger
      includes = lib.util.extend({}, options.globals)
      if typeof v8debug == 'object'
        includes = lib.util.extend(includes, options.globalsDebug)

      for own name, filePath of includes
        if (filePath[0] == '.')
          global[name] = require(path.join(options.base, filePath))
        else
          global[name] = require(filePath)

      return
    )

    fileNames = lib.util.glob.sync(path.join(options.base, options.spec), {})
    for fileName in fileNames
      suite(path.relative(options.base, fileName), () ->
        require(fileName)
      )

  )
{'fraction_non_alphanumeric': 0.16208104052026012, 'fraction_numerical': 0.007503751875937969, 'mean_word_length': 2.795066413662239, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '5596977', 'n_tokens_mistral': 641, 'n_tokens_neox': 627, 'n_words': 124}