Skip to content

Commit

Permalink
Merge pull request #1096 from sanfrancrisko/PDK-1085
Browse files Browse the repository at this point in the history
(PDK-1085) Fail gracefully when no unit tests available
  • Loading branch information
da-ar authored Jun 17, 2021
2 parents f0d1f17 + b59d127 commit 8b168c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/pdk/util/json_finder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def objects
end
end

return [] if @objects.nil?
@objects = @objects.compact
end

Expand Down
6 changes: 6 additions & 0 deletions spec/acceptance/test_unit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
its(:stderr) { is_expected.to match(%r{No files for parallel_spec to run against}i) }
end

describe command('pdk test unit --parallel --format=text:test_output.txt') do
its(:exit_status) { is_expected.to eq(0) }
its(:stderr) { is_expected.to match(%r{preparing to run the unit tests}i) }
its(:stderr) { is_expected.to match(%r{No examples found}i) }
end

context 'with passing tests' do
# FIXME: facterversion pin and facterdb issues
include_context 'with spec file', 'passing_spec.rb', <<-EOF
Expand Down

0 comments on commit 8b168c9

Please sign in to comment.