Class: Parabot::TestRunner
- Inherits:
-
Object
- Object
- Parabot::TestRunner
- Includes:
- DryRunLogging
- Defined in:
- lib/parabot/test_runner.rb
Defined Under Namespace
Classes: TestResult
Constant Summary collapse
- TestExecutionError =
Class.new(StandardError)
Instance Method Summary collapse
-
#initialize(messaging_adapter, language_detector, dry_run: false, config: nil, language: nil) ⇒ TestRunner
constructor
A new instance of TestRunner.
- #run_tests(args: [], send_to_claude: true) ⇒ Object
Constructor Details
#initialize(messaging_adapter, language_detector, dry_run: false, config: nil, language: nil) ⇒ TestRunner
Returns a new instance of TestRunner.
23 24 25 26 27 28 29 |
# File 'lib/parabot/test_runner.rb', line 23 def initialize(messaging_adapter, language_detector, dry_run: false, config: nil, language: nil) @config = config || Configuration.current @dry_run = dry_run @messaging_adapter = messaging_adapter @language = Array(language).first @language_detector = language_detector end |
Instance Method Details
#run_tests(args: [], send_to_claude: true) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/parabot/test_runner.rb', line 31 def run_tests(args: [], send_to_claude: true) test_command = determine_test_command_from_context(args) logger.info("Running tests...") logger.info("Executing: #{test_command}") result = run_command(test_command) test_results = format_test_results(test_command, result) output_file = save_test_output(test_results) TestResult.new( exit_status: result.exit_status, output: output_file || test_results ) rescue SystemCallError => e logger.error("Test execution failed: #{e.}") false rescue StandardError => e raise TestExecutionError, "Failed to run tests: #{e.}" end |