Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/lizard/minitest_reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ def should_report?
return false if ENV["LIZARD_TEST_MODE"]

# Only report from designated matrix job (if specified)
# Branch is covered by send tests but LIZARD_TEST_MODE early return above
# causes SimpleCov to miss the fall-through path
# :nocov:
return false if ENV["LIZARD_REPORT"] != "true"
# :nocov:

ENV["LIZARD_API_KEY"] && ENV["LIZARD_URL"]
end
Expand Down
5 changes: 4 additions & 1 deletion lib/lizard/rspec_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ def should_report?
# Don't report during test runs to avoid coverage inconsistency
return false if ENV["LIZARD_TEST_MODE"]

# Only report from designated matrix job (if specified)
# Branch is covered by send tests but LIZARD_TEST_MODE early return above
# causes SimpleCov to miss the fall-through path
# :nocov:
return false if ENV["LIZARD_REPORT"] != "true"
# :nocov:

ENV["LIZARD_API_KEY"] && ENV["LIZARD_URL"]
end
Expand Down
2 changes: 2 additions & 0 deletions test/minitest_reporter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def test_callback_methods_exist
end

def test_report_sends_to_lizard_when_configured
ENV.delete("LIZARD_TEST_MODE")
ENV["LIZARD_API_KEY"] = "test_key"
ENV["LIZARD_URL"] = "https://test.example.com"
ENV["LIZARD_REPORT"] = "true"
Expand All @@ -50,6 +51,7 @@ def test_report_sends_to_lizard_when_configured
end

def test_report_handles_nil_simplecov_result
ENV.delete("LIZARD_TEST_MODE")
ENV["LIZARD_API_KEY"] = "test_key"
ENV["LIZARD_URL"] = "https://test.example.com"
ENV["LIZARD_REPORT"] = "true"
Expand Down
2 changes: 2 additions & 0 deletions test/rspec_formatter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def test_initialize_accepts_output_parameter
end

def test_dump_summary_sends_to_lizard_when_configured
ENV.delete("LIZARD_TEST_MODE")
ENV["LIZARD_API_KEY"] = "test_key"
ENV["LIZARD_URL"] = "https://test.example.com"
ENV["LIZARD_REPORT"] = "true"
Expand All @@ -50,6 +51,7 @@ def test_dump_summary_sends_to_lizard_when_configured
end

def test_dump_summary_handles_nil_simplecov_result
ENV.delete("LIZARD_TEST_MODE")
ENV["LIZARD_API_KEY"] = "test_key"
ENV["LIZARD_URL"] = "https://test.example.com"
ENV["LIZARD_REPORT"] = "true"
Expand Down
2 changes: 2 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
require "minitest/autorun"
require "mocha/minitest"

ENV["LIZARD_TEST_MODE"] = "true" unless ENV["LIZARD_REPORT"] == "true"

Minitest.extensions << "lizard"

module Minitest
Expand Down
Loading