Sha256: 447ed1403abbfcc414a2d6f59031df66e097fb91ccc1cb1a74872603a0e3812e

Contents?: true

Size: 736 Bytes

Versions: 2

Compression:

Stored size: 736 Bytes

Contents

# frozen_string_literal: true

# test_coverage reporter for Solargraph
module SolargraphTestCoverage
  class TestCoverageReporter < Solargraph::Diagnostics::Base
    include ReporterHelpers
    include ReporterGuards
    include DiagnosticMessages

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

      return [] if source.code.empty? || using_debugger? || exclude_file? || in_test_dir?
      return [test_missing_error] unless test_file_exists?

      @results = run_test(FileHelpers.test_file(@filename))

      [line_warnings, branch_warnings, test_passing_error].flatten.compact
    rescue ChildFailedError => e
      Config.debug? ? [debug_message(e)] : []
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
solargraph_test_coverage-0.3.1.1 lib/solargraph_test_coverage/test_coverage_reporter.rb
solargraph_test_coverage-0.3.1 lib/solargraph_test_coverage/test_coverage_reporter.rb