Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[scan] fix misleading error message when no devices are found #21650

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions scan/lib/scan/detect_values.rb
Expand Up @@ -146,6 +146,8 @@ def self.detect_simulator(devices, requested_os_type, deployment_target_key, def

selector = ->(sim) { pieces.count > 0 && sim.name == pieces.first }

display_device = "'#{device_string}'"

set + (
if pieces.count == 0
[] # empty array
Expand All @@ -157,6 +159,8 @@ def self.detect_simulator(devices, requested_os_type, deployment_target_key, def
.pop(1)
else # pieces.count == 2 -- mathematically, because of the 'end of line' part of our regular expression
version = pieces[1].tr('()', '')
display_device = "'#{pieces[0]}' with version #{version}"

potential_emptiness_error = lambda do |sims|
if sims.empty?
UI.error("No simulators found that are equal to the version " \
Expand All @@ -168,8 +172,8 @@ def self.detect_simulator(devices, requested_os_type, deployment_target_key, def
end
).tap do |array|
if array.empty?
UI.test_failure!("No device found with name '#{device_string}'") if Scan.config[:ensure_devices_found]
UI.error("Ignoring '#{device_string}', couldnt find matching simulator")
UI.test_failure!("No device found with name #{display_device}") if Scan.config[:ensure_devices_found]
UI.error("Ignoring '#{device_string}', couldn't find matching simulator")
end
end
end
Expand Down