Class: SolargraphTestCoverage::ExampleStatusReporter

Inherits:
Solargraph::Diagnostics::Base
  • Object
show all
Includes:
DiagnosticMessages, ReporterGuards, ReporterHelpers
Defined in:
lib/solargraph_test_coverage/example_status_reporter.rb

Instance Method Summary collapse

Methods included from DiagnosticMessages

#branch_coverage_warning, #debug_message, #example_failing_error, #line_coverage_warning, #test_failing_error, #test_missing_error

Methods included from ReporterGuards

#exclude_file?, #in_test_dir?, #test_file_exists?, #test_support_file?, #using_debugger?

Methods included from ReporterHelpers

#branch_warnings, #example_failing_errors, #line_warnings, #run_test, #test_passing_error, #uncovered_lines

Instance Method Details

#diagnose(source, _api_map) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/solargraph_test_coverage/example_status_reporter.rb', line 10

def diagnose(source, _api_map)
  @source    = source
  @filename  = source.location.filename

  return [] if source.code.empty? || using_debugger? || !in_test_dir? || test_support_file?

  @results = run_test(@filename)

  example_failing_errors.compact
rescue ChildFailedError => e
  Config.debug? ? [debug_message(e)] : []
end