Skip to content

Commit

Permalink
(CAT-2026) Update how pdk test unit --list detects an error
Browse files Browse the repository at this point in the history
A recent change has caused the information returned to be in a slightly different format.
Message returned may be different, and include additional details.
  • Loading branch information
david22swan committed Aug 28, 2024
1 parent 9041f64 commit 6e1b471
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/pdk/tests/unit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,10 @@ def self.list(options = {})
raise PDK::CLI::FatalError, format('Failed to find valid JSON in output from rspec: %{output}', output: output[:stdout]) unless rspec_json

if rspec_json['examples'].empty?
rspec_message = rspec_json['messages'][0]
return [] if rspec_message == 'No examples found.'
return [] if rspec_json['messages'][0] == 'No examples found.'
return [] if rspec_json['messages'] == ['Run options: exclude {:bolt=>true}', "\nAll examples were filtered out"]

Check warning on line 250 in lib/pdk/tests/unit.rb

View check run for this annotation

Codecov / codecov/patch

lib/pdk/tests/unit.rb#L250

Added line #L250 was not covered by tests

raise PDK::CLI::FatalError, format('Unable to enumerate examples. rspec reported: %{message}', message: rspec_message)
raise PDK::CLI::FatalError, format('Unable to enumerate examples. rspec reported: %{message}', message: rspec_json['messages'])

Check warning on line 252 in lib/pdk/tests/unit.rb

View check run for this annotation

Codecov / codecov/patch

lib/pdk/tests/unit.rb#L252

Added line #L252 was not covered by tests
else
examples = []
rspec_json['examples'].each do |example|
Expand Down

0 comments on commit 6e1b471

Please sign in to comment.