Skip to content

Commit

Permalink
Merge pull request #196 from Shopify/cbruckmayer/handle-type-error
Browse files Browse the repository at this point in the history
Handle path nil
  • Loading branch information
ChrisBr authored Feb 17, 2023
2 parents c3e63e1 + 682526f commit c012a32
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ruby/lib/minitest/queue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def self.project_root

def self.relative_path(path, root: project_root)
Pathname(path).relative_path_from(Pathname(root)).to_s
rescue ArgumentError
rescue ArgumentError, TypeError
path
end

Expand Down
5 changes: 5 additions & 0 deletions ruby/test/minitest/queue/run_command_formatter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,10 @@ def test_relative_path_with_empty_path
path = Minitest::Queue.relative_path('', root: '/home/willem/src/project')
assert_equal "", path
end

def test_relative_path_with_nil_path
path = Minitest::Queue.relative_path(nil, root: '/home/willem/src/project')
refute path
end
end
end

0 comments on commit c012a32

Please sign in to comment.