Skip to content

Commit c012a32

Browse files
authored
Merge pull request #196 from Shopify/cbruckmayer/handle-type-error
Handle path nil
2 parents c3e63e1 + 682526f commit c012a32

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

ruby/lib/minitest/queue.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def self.project_root
144144

145145
def self.relative_path(path, root: project_root)
146146
Pathname(path).relative_path_from(Pathname(root)).to_s
147-
rescue ArgumentError
147+
rescue ArgumentError, TypeError
148148
path
149149
end
150150

ruby/test/minitest/queue/run_command_formatter_test.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,10 @@ def test_relative_path_with_empty_path
6262
path = Minitest::Queue.relative_path('', root: '/home/willem/src/project')
6363
assert_equal "", path
6464
end
65+
66+
def test_relative_path_with_nil_path
67+
path = Minitest::Queue.relative_path(nil, root: '/home/willem/src/project')
68+
refute path
69+
end
6570
end
6671
end

0 commit comments

Comments
 (0)