<commit_before>require_relative 'harness'
require_relative 'browser'
require_relative 'test_status'
require_relative 'test_case/all'
require_relative "utilities"
require 'rspec/expectations'

module Moose
  class TestCase
    class NoTestBlock < StandardError; end
    class ShortCircuit < StandardError; end
    include TestStatus
    include Utilities::Inspectable
    include RSpec::Matchers
    inspector(:file)

    status_method :result
    attr_accessor :test_block, :start_time, :end_time, :result, :exception, :has_run
    attr_reader :file, :extra_metadata, :test_group, :moose_configuration

    def initialize(file:, test_group:, moose_configuration:, extra_metadata: {})
      @file = file
      @test_group = test_group
      @moose_configuration = moose_configuration
      @extra_metadata = Hash[extra_metadata] || {}
    end

    def build
      Moose.load_test_case_from_file(file: file, test_case: self)
    end

    def test_suite_instance
      test_group.test_suite
    end

    def base_url
      test_suite_instance.configuration.base_url
    end

    def base_url_for(suite_name)
      test_suite_instance.runner.base_url_for(suite_name)
    end

    def browser(index: nil, options: {})
      if index<commit_msg>and god said, “let there be hash”<commit_after>require_relative 'harness'
require_relative 'browser'
require_relative 'test_status'
require_relative 'test_case/all'
require_relative "utilities"
require 'rspec/expectations'

module Moose
  class TestCase
    class NoTestBlock < StandardError; end
    class ShortCircuit < StandardError; end
    include TestStatus
    include Utilities::Inspectable
    include RSpec::Matchers
    inspector(:file)

    status_method :result
    attr_accessor :test_block, :start_time, :end_time, :result, :exception, :has_run
    attr_reader :file, :extra_metadata, :test_group, :moose_configuration

    def initialize(file:, test_group:, moose_configuration:, extra_metadata: {})
      @file = file
      @test_group = test_group
      @moose_configuration = moose_configuration
      begin
        @extra_metadata = Hash[extra_metadata] || {}
      rescue => e
        @extra_metadata = {}
      end
    end

    def build
      Moose.load_test_case_from_file(file: file, test_case: self)
    end

    def test_suite_instance
      test_group.test_suite
    end

    def base_url
      test_suite_instance.configuration.base_url
    end

    def base_url_for(suite_name)
      test_suite_instance.runner.base_url_for(suite_name)
    end

    def browser(index: nil, options: {})
      if index
{'fraction_non_alphanumeric': 0.07668353444920202, 'fraction_numerical': 0.0, 'mean_word_length': 3.821763602251407, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 4, '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': '4973940', 'n_tokens_mistral': 799, 'n_tokens_neox': 787, 'n_words': 178}