<commit_before>measure 'spec suite require time', ->
  {_, fs, Git} = require 'atom'
  path = require 'path'
  require './spec-helper'

  requireSpecs = (specDirectory, specType) ->
    for specFilePath in fs.listTreeSync(specDirectory) when /-spec\.coffee$/.test specFilePath
      require specFilePath

      # Set spec directory on spec for setting up the project in spec-helper
      setSpecDirectory(specDirectory)

  setSpecField = (name, value) ->
    specs = jasmine.getEnv().currentRunner().specs()
    return if specs.length is 0
    for index in [specs.length-1..0]
      break if specs[index][name]?
      specs[index][name] = value

  setSpecType = (specType) ->
    setSpecField('specType', specType)

  setSpecDirectory = (specDirectory) ->
    setSpecField('specDirectory', specDirectory)

  runAllSpecs = ->
    # Only run core specs when resource path is the Atom repository
    if Git.exists(window.resourcePath)
      requireSpecs(path.join(window.resourcePath, 'spec'))
      setSpecType('core')

    fixturesPackagesPath = path.join(__dirname, 'fixtures', 'packages')
    packagePaths = atom.getAvailablePackageNames().map (packageName) -> atom.resolvePackagePath(packageName)
    packagePaths = _.groupBy packagePaths, (packagePath) ->
      if packagePath.indexOf("#{fixturesPackagesPath}#{path.sep}") is 0
        'fixtures'
      else if packagePath.indexOf("#{window.resourcePath}#{path.sep}") is 0
        'bundled'
      else
        'user'

    # Run bundled package specs
    #requireSpecs(path.join(packagePath, 'spec')) for packagePath in packagePaths.bundled ? []
    #setSpecType('bundled')

    # Run user package specs
    #requireSpecs(path.join(packagePath, 'spec')) for packagePath in packagePaths.user ? []
    #setSpecType('user')

  if specDirectory = atom.getLoadSettings().specDirectory
    requireSpecs(specDirectory)
    setSpecType('user')
  else
    runAllSpecs()
<commit_msg>Run bundled and user specs<commit_after>measure 'spec suite require time', ->
  {_, fs, Git} = require 'atom'
  path = require 'path'
  require './spec-helper'

  requireSpecs = (specDirectory, specType) ->
    for specFilePath in fs.listTreeSync(specDirectory) when /-spec\.coffee$/.test specFilePath
      require specFilePath

      # Set spec directory on spec for setting up the project in spec-helper
      setSpecDirectory(specDirectory)

  setSpecField = (name, value) ->
    specs = jasmine.getEnv().currentRunner().specs()
    return if specs.length is 0
    for index in [specs.length-1..0]
      break if specs[index][name]?
      specs[index][name] = value

  setSpecType = (specType) ->
    setSpecField('specType', specType)

  setSpecDirectory = (specDirectory) ->
    setSpecField('specDirectory', specDirectory)

  runAllSpecs = ->
    # Only run core specs when resource path is the Atom repository
    if Git.exists(window.resourcePath)
      requireSpecs(path.join(window.resourcePath, 'spec'))
      setSpecType('core')

    fixturesPackagesPath = path.join(__dirname, 'fixtures', 'packages')
    packagePaths = atom.getAvailablePackageNames().map (packageName) -> atom.resolvePackagePath(packageName)
    packagePaths = _.groupBy packagePaths, (packagePath) ->
      if packagePath.indexOf("#{fixturesPackagesPath}#{path.sep}") is 0
        'fixtures'
      else if packagePath.indexOf("#{window.resourcePath}#{path.sep}") is 0
        'bundled'
      else
        'user'

    # Run bundled package specs
    requireSpecs(path.join(packagePath, 'spec')) for packagePath in packagePaths.bundled ? []
    setSpecType('bundled')

    # Run user package specs
    requireSpecs(path.join(packagePath, 'spec')) for packagePath in packagePaths.user ? []
    setSpecType('user')

  if specDirectory = atom.getLoadSettings().specDirectory
    requireSpecs(specDirectory)
    setSpecType('user')
  else
    runAllSpecs()

{'fraction_non_alphanumeric': 0.11712878984192795, 'fraction_numerical': 0.002591344908007256, 'mean_word_length': 3.7015834348355665, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '1035645', 'n_tokens_mistral': 1161, 'n_tokens_neox': 1122, 'n_words': 278}