class ParallelTests::Test::Runner

def tests_with_size(tests, options)

def tests_with_size(tests, options)
  tests = find_tests(tests, options)
  case options[:group_by]
  when :found
    tests.map! { |t| [t, 1] }
  when :filesize
    sort_by_filesize(tests)
  when :runtime
    sort_by_runtime(tests, runtimes(tests, options), options.merge(allowed_missing: (options[:allowed_missing_percent] || 50) / 100.0))
  when nil
    # use recorded test runtime if we got enough data
    runtimes = runtimes(tests, options) rescue []
    if runtimes.size * 1.5 > tests.size
      puts "Using recorded test runtime"
      sort_by_runtime(tests, runtimes)
    else
      sort_by_filesize(tests)
    end
  else
    raise ArgumentError, "Unsupported option #{options[:group_by]}"
  end
  tests
end